com.gigaspaces.config.lrmi.nio
Class NIOConfiguration

java.lang.Object
  extended by com.gigaspaces.config.lrmi.AbstractTransportConfigration
      extended by com.gigaspaces.config.lrmi.nio.NIOConfiguration
All Implemented Interfaces:
com.gigaspaces.config.IConfiguration, com.gigaspaces.config.lrmi.ITransportConfig, Externalizable, Serializable, Cloneable

public class NIOConfiguration
extends com.gigaspaces.config.lrmi.AbstractTransportConfigration
implements Cloneable, Externalizable

This class provides configuration object of NIO communication transport protocol.

Since:
5.2
See Also:
GenericExporter, Serialized Form

Constructor Summary
NIOConfiguration()
          Should not be used, only for externalizable.
NIOConfiguration(int bindPort)
           
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, boolean isMultiplex, String bindHostName, String bindPort)
          Deprecated. use #NIOConfiguration(int, int, int, String, int) instead
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, boolean isMultiplex, String bindHostName, String bindPort, int threadsQueueSize, int slowConsumerThroughput, int slowConsumerLatency, int slowConsumerRetries)
          Deprecated. use #NIOConfiguration( int, int, int, String, int, int, int, int, int)
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, boolean isMultiplex, String bindHostName, String bindPort, int threadsQueueSize, int slowConsumerThroughput, int slowConsumerLatency, int slowConsumerRetries, int readSelectorThreads, String watchdogRequestTimeout, String watchdogListeningTimeout, String watchdogIdleConnectionTimeout, long threadPoolIdleTimeout, String socketConnectTimeout)
          Deprecated. use #NIOConfiguration( int, int, int, String, int, int, int, int, int, int, String, String, String, long, String) instead
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, boolean isMultiplex, String bindHostName, String bindPort, int readSelectorThreads, String watchdogRequestTimeout, String watchdogListeningTimeout, String watchdogIdleConnectionTimeout, long threadPoolIdleTimeout, String socketConnectTimeout)
          Deprecated. use #NIOConfiguration( int, int, int, String, int, int, String, String, String, long, String)
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, String bindHostName, String bindPort)
           
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, String bindHostName, String bindPort, int threadsQueueSize, int slowConsumerThroughput, int slowConsumerLatency, int slowConsumerRetries)
           
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, String bindHostName, String bindPort, int threadsQueueSize, int slowConsumerThroughput, int slowConsumerLatency, int slowConsumerRetries, int readSelectorThreads, String watchdogRequestTimeout, String watchdogListeningTimeout, String watchdogIdleConnectionTimeout, long threadPoolIdleTimeout, String socketConnectTimeout)
          Constructor.
NIOConfiguration(int minThreads, int maxThreads, int maxConnPool, String bindHostName, String bindPort, int readSelectorThreads, String watchdogRequestTimeout, String watchdogListeningTimeout, String watchdogIdleConnectionTimeout, long threadPoolIdleTimeout, String socketConnectTimeout)
          The most commonly used constructor through the services.config configuration file.
NIOConfiguration(String bindPort)
           
 
Method Summary
 NIOConfiguration clone()
           
 String getBindHostName()
           
 String getBindPort()
           
 int getConnectionPoolSize()
           
 int getMaxConnPool()
           
 int getMaxThreads()
           
 int getMinThreads()
           
 String getProtocolName()
           
 int getReadSelectorThreads()
           
 int getSlowConsumerLatency()
           
 int getSlowConsumerRetries()
           
 int getSlowConsumerThroughput()
           
 long getSocketConnectTimeout()
           
 long getThreadPoolIdleTimeout()
           
 int getThreadsQueueSize()
           
 long getWatchdogIdleConnectionTimeout()
           
 long getWatchdogListeningTimeout()
           
 long getWatchdogRequestTimeout()
           
 boolean isBlockingConnection()
           
 void readExternal(ObjectInput in)
           
 void setBindHost(String bindHostName)
           
 void setBindPort(String bindPort)
           
 void setBlockingConnection(boolean blockingConnection)
           
 void setMaxConnPool(int maxConnPool)
           
 void setMaxThreads(int maxThreads)
           
 void setMinThreads(int minThreads)
           
 void setReadSelectorThreads(int selectorThreads)
           
 void setSlowConsumerLatency(int slowConsumerLatency)
           
 void setSlowConsumerRetries(int slowConsumerRetries)
           
 void setSlowConsumerThroughput(int slowConsumerThroughput)
           
 void setSocketConnectTimeout(long socketConnectTimeout)
           
 void setThreadPoolIdleTimeout(long threadPoolIdleTimeout)
           
 void setThreadsQueueSize(int threadsQueueSize)
           
 void setWatchdogIdleConnectionTimeout(long idleConnectionTimeout)
           
 void setWatchdogListeningTimeout(long listeningTimeout)
           
 void setWatchdogRequestTimeout(long requestTimeout)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class com.gigaspaces.config.lrmi.AbstractTransportConfigration
getProtocolAdaptorClass
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NIOConfiguration

@Deprecated
public NIOConfiguration(int minThreads,
                                   int maxThreads,
                                   int maxConnPool,
                                   boolean isMultiplex,
                                   String bindHostName,
                                   String bindPort)
Deprecated. use #NIOConfiguration(int, int, int, String, int) instead


NIOConfiguration

public NIOConfiguration(int minThreads,
                        int maxThreads,
                        int maxConnPool,
                        String bindHostName,
                        String bindPort)

NIOConfiguration

@Deprecated
public NIOConfiguration(int minThreads,
                                   int maxThreads,
                                   int maxConnPool,
                                   boolean isMultiplex,
                                   String bindHostName,
                                   String bindPort,
                                   int readSelectorThreads,
                                   String watchdogRequestTimeout,
                                   String watchdogListeningTimeout,
                                   String watchdogIdleConnectionTimeout,
                                   long threadPoolIdleTimeout,
                                   String socketConnectTimeout)
Deprecated. use #NIOConfiguration( int, int, int, String, int, int, String, String, String, long, String)

The most commonly used constructor through the services.config configuration file.


NIOConfiguration

public NIOConfiguration(int minThreads,
                        int maxThreads,
                        int maxConnPool,
                        String bindHostName,
                        String bindPort,
                        int readSelectorThreads,
                        String watchdogRequestTimeout,
                        String watchdogListeningTimeout,
                        String watchdogIdleConnectionTimeout,
                        long threadPoolIdleTimeout,
                        String socketConnectTimeout)
The most commonly used constructor through the services.config configuration file.


NIOConfiguration

@Deprecated
public NIOConfiguration(int minThreads,
                                   int maxThreads,
                                   int maxConnPool,
                                   boolean isMultiplex,
                                   String bindHostName,
                                   String bindPort,
                                   int threadsQueueSize,
                                   int slowConsumerThroughput,
                                   int slowConsumerLatency,
                                   int slowConsumerRetries,
                                   int readSelectorThreads,
                                   String watchdogRequestTimeout,
                                   String watchdogListeningTimeout,
                                   String watchdogIdleConnectionTimeout,
                                   long threadPoolIdleTimeout,
                                   String socketConnectTimeout)
Deprecated. use #NIOConfiguration( int, int, int, String, int, int, int, int, int, int, String, String, String, long, String) instead


NIOConfiguration

public NIOConfiguration(int minThreads,
                        int maxThreads,
                        int maxConnPool,
                        String bindHostName,
                        String bindPort,
                        int threadsQueueSize,
                        int slowConsumerThroughput,
                        int slowConsumerLatency,
                        int slowConsumerRetries,
                        int readSelectorThreads,
                        String watchdogRequestTimeout,
                        String watchdogListeningTimeout,
                        String watchdogIdleConnectionTimeout,
                        long threadPoolIdleTimeout,
                        String socketConnectTimeout)
Constructor.

Parameters:
minThreads - Maintains thread pool in Client and Server that manage incoming remote requests. The thread pool size is increased each time with one additional thread and shrinks when existing threads are not used for 5 minutes. This parameter specifies the minimum size of this thread pool.
maxThreads - This parameter specifies the maximum size of this thread pool. You should make sure the pool max size will accommodate the maximum number of concurrent requests to the serverEndPoint. When the pool is exhausted and all threads are consumed to process incoming requests, additional requests will be blocked until existing requested processing will be completed.
maxConnPool - Client connection pool maximum size to server. Starts with 1 connection.
isMultiplex - This property should be set to true if there are many concurrent connections to the serverEndPoint. When running many concurrent remote clients the serverEndPoint by default opens a dedicated network channel and thread for each remote client. These network channel consumes resources. To optimize the serverEndPoint handling with concurrent access set isMultiplex=true. This allows the serverEndPoint to share the same network channel and thread pool for multiple concurrent clients. In general when running in isMultiplex=false the serverEndPoint generates and maintains thread pool and different space resources per connection. This is very expensive both in terms of CPU and memory when having many users - even with more than 3 connections!. The isMultiplex=false is relevant only for very few concurrent connections (1-3).
bindHostName - The host address the server socket is bound to. Relevant for the multi-NIC environment. If null resolves to the localhost IP address.
bindPort - the bind port used for incoming client requests. The server port is set by default to 0, which means next free port. This means that whenever the serverEndPoint is launched it allocates one of the available ports. Define a specific port value to enforce a specific port for the serverEndPoint.
threadsQueueSize - Maintains thread pool queue size in Client and Server that manage incoming remote requests. Once the queue sized is reached the incoming messages are blocked.
slowConsumerThroughput - a client that its network throughput doesn't reach this limit will be suspected as slow.
slowConsumerLatency - a client that is suspected as slow that will not be recover after this time will be disconnected.
slowConsumerRetries - the number of retries to recover a client that is suspected as slow.
readSelectorThreads - LRMI number of read selector threads default = 1.
watchdogRequestTimeout - LRMI Watchdog request timeout.
watchdogListeningTimeout - LRMI Watchdog Listening timeout.
watchdogIdleConnectionTimeout -
threadPoolIdleTimeout - LRMI ThreadPool idle timeout
socketConnectTimeout - The timeout on lrmi socket connect.
See Also:
SystemProperties.LRMI_READ_SELECTOR_THREADS, SystemProperties.WATCHDOG_REQUEST_TIMEOUT_DEFAULT, SystemProperties.WATCHDOG_LISTENING_TIMEOUT_DEFAULT

NIOConfiguration

@Deprecated
public NIOConfiguration(int minThreads,
                                   int maxThreads,
                                   int maxConnPool,
                                   boolean isMultiplex,
                                   String bindHostName,
                                   String bindPort,
                                   int threadsQueueSize,
                                   int slowConsumerThroughput,
                                   int slowConsumerLatency,
                                   int slowConsumerRetries)
Deprecated. use #NIOConfiguration( int, int, int, String, int, int, int, int, int)


NIOConfiguration

public NIOConfiguration(int minThreads,
                        int maxThreads,
                        int maxConnPool,
                        String bindHostName,
                        String bindPort,
                        int threadsQueueSize,
                        int slowConsumerThroughput,
                        int slowConsumerLatency,
                        int slowConsumerRetries)

NIOConfiguration

public NIOConfiguration()
Should not be used, only for externalizable.


NIOConfiguration

public NIOConfiguration(int bindPort)

NIOConfiguration

public NIOConfiguration(String bindPort)
Method Detail

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

getConnectionPoolSize

public int getConnectionPoolSize()
Specified by:
getConnectionPoolSize in interface com.gigaspaces.config.lrmi.ITransportConfig

setMinThreads

public void setMinThreads(int minThreads)

setMaxThreads

public void setMaxThreads(int maxThreads)

setMaxConnPool

public void setMaxConnPool(int maxConnPool)

setBindHost

public void setBindHost(String bindHostName)

setBindPort

public void setBindPort(String bindPort)

setBlockingConnection

public void setBlockingConnection(boolean blockingConnection)

getMinThreads

public int getMinThreads()

getMaxThreads

public int getMaxThreads()

getMaxConnPool

public int getMaxConnPool()

getBindPort

public String getBindPort()

getBindHostName

public String getBindHostName()

getProtocolName

public final String getProtocolName()
Specified by:
getProtocolName in interface com.gigaspaces.config.lrmi.ITransportConfig

isBlockingConnection

public boolean isBlockingConnection()
Specified by:
isBlockingConnection in interface com.gigaspaces.config.lrmi.ITransportConfig

getThreadsQueueSize

public int getThreadsQueueSize()

setThreadsQueueSize

public void setThreadsQueueSize(int threadsQueueSize)

getSlowConsumerLatency

public int getSlowConsumerLatency()
Specified by:
getSlowConsumerLatency in interface com.gigaspaces.config.lrmi.ITransportConfig

setSlowConsumerLatency

public void setSlowConsumerLatency(int slowConsumerLatency)

getSlowConsumerRetries

public int getSlowConsumerRetries()
Specified by:
getSlowConsumerRetries in interface com.gigaspaces.config.lrmi.ITransportConfig

setSlowConsumerRetries

public void setSlowConsumerRetries(int slowConsumerRetries)

getSlowConsumerThroughput

public int getSlowConsumerThroughput()
Specified by:
getSlowConsumerThroughput in interface com.gigaspaces.config.lrmi.ITransportConfig

setSlowConsumerThroughput

public void setSlowConsumerThroughput(int slowConsumerThroughput)

getReadSelectorThreads

public int getReadSelectorThreads()
Specified by:
getReadSelectorThreads in interface com.gigaspaces.config.lrmi.ITransportConfig
Returns:
Returns the _readSelectorThreads.

setReadSelectorThreads

public void setReadSelectorThreads(int selectorThreads)
Specified by:
setReadSelectorThreads in interface com.gigaspaces.config.lrmi.ITransportConfig
Parameters:
selectorThreads - The _readSelectorThreads to set.

getWatchdogRequestTimeout

public long getWatchdogRequestTimeout()
Specified by:
getWatchdogRequestTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig
Returns:
Returns the _watchdogRequestTimeout.

setWatchdogRequestTimeout

public void setWatchdogRequestTimeout(long requestTimeout)
Specified by:
setWatchdogRequestTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig
Parameters:
requestTimeout - The _watchdogRequestTimeout to set.

getWatchdogListeningTimeout

public long getWatchdogListeningTimeout()
Specified by:
getWatchdogListeningTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig
Returns:
Returns the _watchdogListeningTimeout.

setWatchdogListeningTimeout

public void setWatchdogListeningTimeout(long listeningTimeout)
Specified by:
setWatchdogListeningTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig
Parameters:
listeningTimeout - The _watchdogListeningTimeout to set.

getWatchdogIdleConnectionTimeout

public long getWatchdogIdleConnectionTimeout()
Specified by:
getWatchdogIdleConnectionTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig
Returns:
Returns the _watchdogIdleConnectionTimeout.

setWatchdogIdleConnectionTimeout

public void setWatchdogIdleConnectionTimeout(long idleConnectionTimeout)
Specified by:
setWatchdogIdleConnectionTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig
Parameters:
idleConnectionTimeout - The _watchdogIdleConnectionTimeout to set.

getThreadPoolIdleTimeout

public long getThreadPoolIdleTimeout()
Specified by:
getThreadPoolIdleTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig

setThreadPoolIdleTimeout

public void setThreadPoolIdleTimeout(long threadPoolIdleTimeout)
Specified by:
setThreadPoolIdleTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig

getSocketConnectTimeout

public long getSocketConnectTimeout()
Specified by:
getSocketConnectTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig

setSocketConnectTimeout

public void setSocketConnectTimeout(long socketConnectTimeout)
Specified by:
setSocketConnectTimeout in interface com.gigaspaces.config.lrmi.ITransportConfig

clone

public NIOConfiguration clone()
Overrides:
clone in class Object
Returns:
a shallow copy of this NIOConfiguration instance.

toString

public String toString()
Overrides:
toString in class Object