Class NetworkConnectorConfig<T>

    • Constructor Detail

      • NetworkConnectorConfig

        public NetworkConnectorConfig()
    • Method Detail

      • getProtocol

        public String getProtocol()
        Returns the connector's protocol identifier (see setProtocol(String)).
        Returns:
        Protocol identifier.
      • setProtocol

        public void setProtocol​(String protocol)
        Sets the connector's protocol identifier. Can contain only alpha-numeric characters and non-repeatable dots/hyphens.

        This protocol identifier can be used to obtain references to NetworkConnector instances via NetworkService.connector(String) method.

        This parameter is mandatory and doesn't have a default value.

        Note: Protocol identifier must be unique across all registered NetworkConnectors within the NetworkService.

        Parameters:
        protocol - Protocol identifier (can contain only alpha-numeric characters and non-repeatable dots/hyphens).
      • getIdleSocketTimeout

        public long getIdleSocketTimeout()
        Returns the timeout in milliseconds for NetworkClients to stay idle before being automatically disconnected (see setIdleSocketTimeout(long)).
        Returns:
        Timeout in milliseconds.
      • setIdleSocketTimeout

        public void setIdleSocketTimeout​(long idleSocketTimeout)
        Sets the timeout in milliseconds for NetworkClients to stay idle before being automatically disconnected.

        NetworkClients are considered to be idle if no messages are send/received for the specified time interval. When idle client is detected it will be automatically disconnected.

        If value of this parameter is less than or equals to zero then idle clients tracking is disabled.

        Default value of this parameter is 0.

        Parameters:
        idleSocketTimeout - Timeout in milliseconds.
      • getNioThreads

        public int getNioThreads()
        Returns the thread pool size that should be used for NIO events processing (see setNioThreads(int)).
        Returns:
        Thread pool size.
      • setNioThreads

        public void setNioThreads​(int nioThreads)
        Sets the thread pool size that should be used for NIO events processing.

        If value of this parameter is above zero then a new thread pool of that size will be initialized and used by the NetworkConnector to handle all NIO events of its connections. If value of this parameter is less than or equals to zero then NetworkService's core thread pool will be used (see NetworkServiceFactory.setNioThreads(int)).

        Default value of this parameter is 0.

        Parameters:
        nioThreads - Thread pool size.
        See Also:
        NetworkServiceFactory.setNioThreads(int)
      • getLogCategory

        public String getLogCategory()
        Returns the log category that should be used by the connector (see setLogCategory(String)).
        Returns:
        Log category.
      • setLogCategory

        public void setLogCategory​(String logCategory)
        Sets the log category that should be used by the connector.
        Parameters:
        logCategory - Log category.
      • getServerHandler

        public NetworkServerHandler<T> getServerHandler()
        Returns the handler that should be used to accept connections and process messages from remote connectors (see setServerHandler(NetworkServerHandler)).
        Returns:
        Handler that should be used to accept connections and process messages from remote connectors.
      • setServerHandler

        public void setServerHandler​(NetworkServerHandler<T> serverHandler)
        Sets the server handler that should be used to accept connections and process messages from remote connectors.

        This parameter is optional and if not specified then connector will work in client-only mode. In this mode it will be able to create new NetworkClient connections but will not be able to accept such connections from remote connectors.

        Parameters:
        serverHandler - Handler that should be used to accept connections and process messages from remote connectors.