Package com.gpudb

Class GPUdbBase.Options

  • Enclosing class:
    GPUdbBase

    public static final class GPUdbBase.Options
    extends Object
    A set of configurable options for the GPUdb API. May be passed into the GPUdb constructor to override the default options.
    • Constructor Detail

      • Options

        public Options()
        No-argument constructor needed for the copy constructor.
      • Options

        public Options​(GPUdbBase.Options other)
        Copy constructor. Note: Member executor will get a shallow copy.
    • Method Detail

      • toString

        public String toString()
        Returns the set of options as a JSON-style string
        Overrides:
        toString in class Object
        Returns:
        options as a String
      • getPrimaryUrl

        public String getPrimaryUrl()
        Gets the URL of the primary cluster of the HA environment.
        Returns:
        the primary URL
        See Also:
        setPrimaryUrl(String)
      • getUsername

        public String getUsername()
        Gets the username to be used for authentication to GPUdb.
        Returns:
        the username
        See Also:
        setUsername(String)
      • getPassword

        public String getPassword()
        Gets the password to be used for authentication to GPUdb.
        Returns:
        the password
        See Also:
        setPassword(String)
      • getOauthToken

        public String getOauthToken()
        Gets the OAuth access token to be used for authentication to GPUdb.
        Returns:
        the OAuth access token
        See Also:
        setOauthToken(String)
      • getHostnameRegex

        public Pattern getHostnameRegex()
        Gets the regex pattern to be used to filter URLs of the servers. If null, then the first URL encountered per rank will be used.
        Returns:
        the IP or hostname regex to match URLs against
        See Also:
        setHostnameRegex(Pattern)
      • getUseSnappy

        public boolean getUseSnappy()
        Gets the value of the flag indicating whether to use Snappy compression for certain GPUdb requests that potentially submit large amounts of data.
        Returns:
        the value of the Snappy compression flag
        See Also:
        setUseSnappy(boolean)
      • getBypassSslCertCheck

        public boolean getBypassSslCertCheck()
        Gets the value of the flag indicating whether to verify the SSL certificate for HTTPS connections.
        Returns:
        the value of the SSL certificate verification bypass flag
        See Also:
        setBypassSslCertCheck(boolean)
      • getTrustStoreFilePath

        public String getTrustStoreFilePath()
        Gets the value of the SSL trustStore file path
        Returns:
        - a String - SSL trustStore file path
      • getTrustStorePassword

        public String getTrustStorePassword()
        Gets the SSL trustStore file password
        Returns:
        - a String - trustStore file password
      • getDisableFailover

        public boolean getDisableFailover()
        Gets the value of the flag indicating whether to disable failover upon failures.
        Returns:
        the value of the failover disabling flag
        See Also:
        setDisableFailover(boolean)
      • getDisableAutoDiscovery

        public boolean getDisableAutoDiscovery()
        Gets the value of the flag indicating whether to disable automatic discovery of backup clusters or worker rank URLs. If set to true, then the GPUdb object will not connect to the database at initialization time, and will only work with the URLs given. Default is false.
        Returns:
        the value of the automatic discovery disabling flag
        See Also:
        setDisableAutoDiscovery(boolean)
      • getHostManagerPort

        public int getHostManagerPort()
        Gets the host manager port number. Some endpoints are supported only at the host manager, rather than the head node of the database.
        Returns:
        the host manager port
        See Also:
        setHostManagerPort(int)
      • getConnectionInactivityValidationTimeout

        public int getConnectionInactivityValidationTimeout()
        Gets the period of inactivity (in milliseconds) after which connection validity would be checked before reusing it. This is for fine-tuning server connection parameters. Using the default of 100ms should suffice for most users.
        Returns:
        the connection inactivity period (in milliseconds)
        See Also:
        setConnectionInactivityValidationTimeout(int)
      • getTimeout

        public int getTimeout()
        Gets the timeout value, in milliseconds, after which a lack of response from the GPUdb server will result in requests being aborted. A timeout of zero is interpreted as an infinite timeout. Note that this applies independently to various stages of communication, so overall a request may run for longer than this without being aborted.
        Returns:
        the timeout value
        See Also:
        setTimeout(int), getServerConnectionTimeout()
      • getServerConnectionTimeout

        public int getServerConnectionTimeout()
        Gets the server connection timeout value, in milliseconds, after which an inability to establish a connection with the GPUdb server will result in requests being aborted. This serves to limit both the time waiting to initially connect to the server and the time waiting for a response from the server when performing a status check. A timeout of zero is interpreted as an infinite timeout. Note that this is different from the request timeout for requests other than a system status check.
        Returns:
        the connection timeout value
        See Also:
        getTimeout(), setServerConnectionTimeout(int)
      • getMaxTotalConnections

        public int getMaxTotalConnections()
        Gets the maximum number of connections, across all hosts, allowed at any given time.
        Returns:
        the maxTotalConnections value
        See Also:
        setMaxTotalConnections(int)
      • getMaxConnectionsPerHost

        public int getMaxConnectionsPerHost()
        Gets the maximum number of connections, per host, allowed at any given time.
        Returns:
        the maxConnectionsPerHost value
        See Also:
        setMaxConnectionsPerHost(int)
      • getClusterReconnectCount

        @Deprecated(since="7.1.9",
                    forRemoval=true)
        public static int getClusterReconnectCount()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Gets the number of times the API tries to reconnect to the same cluster (when a failover event has been triggered), before actually failing over to any available backup cluster.
        Returns:
        the clusterReconnectCount value
        See Also:
        setClusterReconnectCount(int)
      • getInitialConnectionAttemptTimeout

        public long getInitialConnectionAttemptTimeout()
        Gets the timeout used when trying to establish a connection to the database at GPUdb initialization. The value is given in milliseconds and the default is 0. 0 indicates no retry will be done; instead, the user given URLs will be stored without farther discovery. If multiple URLs are given by the user, then API will try all of them once before retrying or giving up. When this timeout is set to a non-zero value, and the first attempt failed, then the API will wait (sleep) for a certain amount of time and try again. Upon consecutive failures, the sleep amount will be doubled. So, before the first retry (i.e. the second attempt), the API will sleep for one minute. Before the second retry, the API will sleep for two minutes, the next sleep interval would be four minutes, and onward.
        Returns:
        the initialConnectionAttemptTimeout value
        See Also:
        setInitialConnectionAttemptTimeout(long)
      • getIntraClusterFailoverTimeout

        @Deprecated(since="7.1.9",
                    forRemoval=true)
        public static long getIntraClusterFailoverTimeout()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Gets the timeout used when trying to recover from an intra-cluster failover event. The value is given in milliseconds. Returns 0.
        Returns:
        the intraClusterFailoverTimeout value
        See Also:
        setIntraClusterFailoverTimeout( long )
      • setPrimaryUrl

        public GPUdbBase.Options setPrimaryUrl​(String value)
        Sets the URL of the primary cluster to use amongst the HA clusters. This cluster will always be used first. It can be part of the URLs used to create the GPUdb object, or be a different one. In either case, this URL will always be chosen first to work against. Also, the GPUdb constructors will ensure that no duplicate of this URL exists in the full set of URLs to use. If this is not set, then all available clusters will be treated with equal probability (unless only a single URL is given for the Kinetica server, in which case it will also be treated as the primary cluster). Can be given in the form of 'http[s]://X.X.X.X:PORT[/httpd-path]' or just the IP address or the hostname.
        Parameters:
        value - the URL of the primary cluster
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getPrimaryUrl()
      • setUsername

        public GPUdbBase.Options setUsername​(String value)
        Sets the username to be used for authentication to GPUdb. This username will be sent with every GPUdb request made via the API along with the password and may be used for authorization decisions by the server if it is so configured. If both the username and password are null (the default) or empty strings, no authentication will be performed.
        Parameters:
        value - the username
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getUsername(), setPassword(String)
      • setPassword

        public GPUdbBase.Options setPassword​(String value)
        Sets the password to be used for authentication to GPUdb. This password will be sent with every GPUdb request made via the API along with the username and may be used for authorization decisions by the server if it is so configured. If both the username and password are null (the default) or empty strings, no authentication will be performed.
        Parameters:
        value - the password
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getPassword(), setUsername(String)
      • setOauthToken

        public GPUdbBase.Options setOauthToken​(String value)
        Sets the OAuth2 access token to be used for authentication to GPUdb. This token will be sent with every GPUdb request made via the API and may be used for authorization decisions by the server if it is so configured. If set, OAuth2 authentication will be attempted; if not, basic username/password authentication will be attempted.
        Parameters:
        value - the OAuth access token to be used for authentication
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getOauthToken()
      • setHostnameRegex

        public GPUdbBase.Options setHostnameRegex​(String value)
                                           throws GPUdbException
        Sets the IP address or hostname regex against which the server's rank URLs would be matched when obtaining them. If null, then the first URL for any given rank would be used (if multiple are available in the system properties). Note that the regex MUST NOT have the protocol or the port; it should be a regular expression ONLY for the hostname/IP address. Note also that the regex must match all servers in all clusters of the ring, as there is only one in use per connection.
        Parameters:
        value - the IP or hostname regex to match URLs against
        Returns:
        the current GPUdbBase.Options instance
        Throws:
        GPUdbException
        See Also:
        getHostnameRegex()
      • setHostnameRegex

        public GPUdbBase.Options setHostnameRegex​(Pattern value)
        Sets the IP address or hostname regex against which the server's rank URLs would be matched when obtaining them. If null, then the first URL for any given rank would be used (if multiple are available in the system properties). Note that the regex MUST have an **optional** [http://] or [https://] part to it since the regex would be applied in various scenarios (where the protocol is sometimes present and sometimes not). Note also that the regex must match all servers in all clusters of the ring, as there is only one in use per connection.
        Parameters:
        value - the IP or hostname regex to match URLs against
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getHostnameRegex()
      • setUseSnappy

        public GPUdbBase.Options setUseSnappy​(boolean value)
        Sets the flag indicating whether to use Snappy compression for certain GPUdb requests that potentially submit large amounts of data. If true, such requests will be automatically compressed before being sent to the server; the default is false.
        Parameters:
        value - the new value for the Snappy compression flag
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getUseSnappy()
      • setBypassSslCertCheck

        public GPUdbBase.Options setBypassSslCertCheck​(boolean value)
        Sets the flag indicating whether to verify the SSL certificate for HTTPS connections. If true, then the SSL certificate sent by the server during HTTPS connection handshake will not be verified; the public key sent by the server will be blindly trusted and used to encrypt the packets. The default is false.
        Parameters:
        value - the value of the SSL certificate verification bypass flag
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getBypassSslCertCheck()
      • setTrustStoreFilePath

        public GPUdbBase.Options setTrustStoreFilePath​(String trustStoreFilePath)
        Sets the SSL trustStore file path. This is useful if the user wants to pass in a self-signed certificate. If this is passed in then the corresponding password for the file must also be set.
           GPUdbBase.Options m_gpudbOptions = new GPUdbBase.Options();
           m_gpudbOptions = m_gpudbOptions.setTrustStoreFilePath(m_trustStoreFileName);
           m_gpudbOptions = m_gpudbOptions.setTrustStorePassword(m_trustStorePassword);
         
        Parameters:
        trustStoreFilePath - - String indicating the full file path
        Returns:
        - the current GPUdbBase.Options instance
        See Also:
        setTrustStorePassword(String)
      • setTrustStorePassword

        public GPUdbBase.Options setTrustStorePassword​(String trustStorePassword)
        Sets the SSL trustStore file password. This is useful if the user wants to pass in a self-signed certificate.
           GPUdbBase.Options m_gpudbOptions = new GPUdbBase.Options();
           m_gpudbOptions = m_gpudbOptions.setTrustStoreFilePath(m_trustStoreFileName);
           m_gpudbOptions = m_gpudbOptions.setTrustStorePassword(m_trustStorePassword);
         
        Parameters:
        trustStorePassword - - String indicating the full file path
        Returns:
        - the current GPUdbBase.Options instance
        See Also:
        (String)
      • setDisableFailover

        public GPUdbBase.Options setDisableFailover​(boolean value)
        Sets the value of the flag indicating whether to disable failover upon failures. If true, then no failover would be attempted upon triggering events regardless of the availability of a high availability cluster. The default is false.
        Parameters:
        value - the value of the failover disabling flag
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getDisableFailover()
      • setDisableAutoDiscovery

        public GPUdbBase.Options setDisableAutoDiscovery​(boolean value)
        Sets the value of the flag indicating whether to disable automatic discovery of backup clusters or worker rank URLs. If set to true, then the GPUdb object will not connect to the database at initialization time, and will only work with the URLs given.
        Parameters:
        value - the value of the automatic discovery disabling flag
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getDisableAutoDiscovery()
      • setThreadCount

        public GPUdbBase.Options setThreadCount​(int value)
        Sets the number of threads that will be used during data encoding and decoding operations. If set to one (the default), all encoding and decoding will be performed in the calling thread. If an executor service is provided, it will be used for thread management, and up to this many operations will be submitted to it at a time for execution. (Note that if the provided executor service supports fewer than this many threads, fewer operations will actually be executed simultaneously.) If no executor service is provided, any required threads will be created on demand.
        Parameters:
        value - the number of threads
        Returns:
        the current GPUdbBase.Options instance
        Throws:
        IllegalArgumentException - if value is less than one
        See Also:
        getThreadCount(), setExecutor(ExecutorService)
      • addHttpHeader

        public GPUdbBase.Options addHttpHeader​(String header,
                                               String value)
        Adds an HTTP header to the map of additional HTTP headers to send to GPUdb with each request. If the header is already in the map, its value is replaced with the specified value.
        Parameters:
        header - the HTTP header
        value - the value of the HTTP header
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getHttpHeaders(), setHttpHeaders(Map)
      • setHostManagerPort

        public GPUdbBase.Options setHostManagerPort​(int value)
        Sets the host manager port number. Some endpoints are supported only at the host manager, rather than the head node of the database.
        Parameters:
        value - the host manager port number
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getHostManagerPort()
      • setTimeout

        public GPUdbBase.Options setTimeout​(int value)
        Sets the timeout value, in milliseconds, after which a lack of response from the GPUdb server will result in requests being aborted. A timeout of zero is interpreted as an infinite timeout. Note that this applies independently to various stages of communication, so overall a request may run for longer than this without being aborted.
        Parameters:
        value - the timeout value
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getTimeout()
      • setServerConnectionTimeout

        public GPUdbBase.Options setServerConnectionTimeout​(int value)
        Gets the server connection timeout value, in milliseconds, after which an inability to establish a connection with the GPUdb server will result in requests being aborted. This serves to limit both the time waiting to initially connect to the server and the time waiting for a response from the server when performing a status check. A timeout of zero is interpreted as an infinite timeout. Note that this is different from the request timeout for requests other than a system status check. Sets the server connection timeout value, in milliseconds, after which an inability to establish a connection with the GPUdb server will result in requests being aborted. This serves to limit both the time waiting to initially connect to the server and the time waiting for a response from the server when performing a status check. A timeout of zero is interpreted as an infinite timeout. Note that this is different from the request timeout for requests other than a system status check. The default is 5000, which is equivalent to 5 seconds.
        Parameters:
        value - the server connection timeout value
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getServerConnectionTimeout()
      • setConnectionInactivityValidationTimeout

        public GPUdbBase.Options setConnectionInactivityValidationTimeout​(int value)
        Sets the period of inactivity (in milliseconds) after which connection validity would be checked before reusing it. This is for fine-tuning server connection parameters. Using the default of 200ms should suffice for most users. The default is 100 (in milliseconds). *Note*: Non-positive value passed to this method disables connection validation. So, use with great caution!
        Parameters:
        value - the connection inactivity timeout (in milliseconds)
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getServerConnectionTimeout()
      • setMaxTotalConnections

        public GPUdbBase.Options setMaxTotalConnections​(int value)
        Sets the maximum number of connections, across all hosts, allowed at any given time. Must be 1 at a minimum. The default value is 40.
        Parameters:
        value - the maxTotalConnections value
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getMaxTotalConnections()
      • setMaxConnectionsPerHost

        public GPUdbBase.Options setMaxConnectionsPerHost​(int value)
        Sets the maximum number of connections, per host, allowed at any given time. Must be 1 at a minimum. The default value is 10.
        Parameters:
        value - the maxConnectionsPerHost value
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getMaxConnectionsPerHost()
      • setClusterReconnectCount

        @Deprecated(since="7.1.9",
                    forRemoval=true)
        public GPUdbBase.Options setClusterReconnectCount​(int value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Sets the number of times the API tries to reconnect to the same cluster (when a failover event has been triggered), before actually failing over to any available backup cluster.
        Parameters:
        value - the clusterReconnectCount value
        Returns:
        the current GPUdbBase.Options instance
      • setInitialConnectionAttemptTimeout

        public GPUdbBase.Options setInitialConnectionAttemptTimeout​(long value)
        Sets the timeout used when trying to establish a connection to the database at GPUdb initialization. The value is given in milliseconds. 0 indicates no retry will be done; instead, the user given URLs will be stored without farther discovery. If multiple URLs are given by the user, then the API will try all of them once before retrying or giving up. When this timeout is set to a non-zero value, and the first attempt failed, then the API will wait (sleep) for a certain amount of time and try again. Upon consecutive failures, the sleep amount will be doubled. So, before the first retry (i.e. the second attempt), the API will sleep for one minute. Before the second retry, the API will sleep for two minutes, the next sleep interval would be four minutes, and onward. The default is 0, meaning the connection will NOT be re-attempted upon failure.
        Parameters:
        value - the initialConnectionAttemptTimeout value
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getInitialConnectionAttemptTimeout()
      • setIntraClusterFailoverTimeout

        @Deprecated(since="7.1.9",
                    forRemoval=true)
        public GPUdbBase.Options setIntraClusterFailoverTimeout​(long value)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Sets the timeout used when trying to recover from an intra-cluster failover event. The value is given in milliseconds.
        Parameters:
        value - the intraClusterFailoverTimeout value
        Returns:
        the current GPUdbBase.Options instance
        See Also:
        getIntraClusterFailoverTimeout()