com.devexperts.qd.qtp.nio
Class NioServerConnector

java.lang.Object
  extended by com.devexperts.qd.qtp.AbstractMessageConnector
      extended by com.devexperts.qd.qtp.nio.NioServerConnector
All Implemented Interfaces:
MessageConnector, MessageConnectorMBean, NioServerConnectorMBean

@MessageConnectorSummary(info="TCP/IP server socket connector with scalable non-blocking api.",
                         addressFormat="nio:",
                         properties={})
public class NioServerConnector
extends AbstractMessageConnector
implements NioServerConnectorMBean

Server socket connector that uses scalable non-blocking socket API (java.nio).


Field Summary
 
Fields inherited from class com.devexperts.qd.qtp.AbstractMessageConnector
DEFAULT_READ_AGGREGATION_SIZE, DEFAULT_RECONNECT_DELAY, log
 
Constructor Summary
NioServerConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory, int port)
          Creates new NIO server socket connector.
NioServerConnector(MessageAdapter.Factory factory, int port)
          Deprecated. use NioServerConnector(com.devexperts.connector.proto.ApplicationConnectionFactory, int)
 
Method Summary
 java.lang.String getAddress()
          Returns address string of this connector.
 java.lang.String getBindAddr()
           
 int getConnectionCount()
          Returns number of established connections.
 com.devexperts.transport.stats.EndpointStats getEndpointStats()
          Returns statistics for this message connector.
 int getLocalPort()
           
 int getSocketTimeout()
           
 MessageConnectorState getState()
          Returns message connector state.
 boolean isActive()
          Returns true if connector is started (not stopped).
 void setBindAddr(java.lang.String newBindAddress)
           
 void setLocalPort(int port)
           
 void setSocketTimeout(int socketTimeout)
           
 void setStats(QDStats stats)
          Changes QDStats associated with this message connector.
 void start()
          Starts connector (connection is immediately established).
 void stop()
          Stops connector (connection is immediately dropped).
 
Methods inherited from class com.devexperts.qd.qtp.AbstractMessageConnector
addClosedConnectionStats, addMessageConnectorListener, getFactory, getLogging, getName, getReconnectDelay, getStats, getThreadPriority, notifyMessageConnectorListeners, reconfigure, removeMessageConnectorListener, restart, setName, setReconnectDelay, setThreadPriority, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.devexperts.qd.qtp.MessageConnectorMBean
getName, getReconnectDelay, getThreadPriority, restart, setName, setReconnectDelay, setThreadPriority
 

Constructor Detail

NioServerConnector

@Deprecated
public NioServerConnector(MessageAdapter.Factory factory,
                                     int port)
Deprecated. use NioServerConnector(com.devexperts.connector.proto.ApplicationConnectionFactory, int)

Constructs new NIO server socket connector.

Parameters:
factory - message adapter factory to use
port - TCP port to use
Throws:
java.lang.NullPointerException - if factory is null

NioServerConnector

public NioServerConnector(com.devexperts.connector.proto.ApplicationConnectionFactory factory,
                          int port)
Creates new NIO server socket connector.

Parameters:
factory - application connection factory to use
port - TCP port to use
Throws:
java.lang.NullPointerException - if factory is null
Method Detail

start

public void start()
Description copied from interface: MessageConnectorMBean
Starts connector (connection is immediately established). Does nothing if connector is already started.

Specified by:
start in interface MessageConnectorMBean
Specified by:
start in class AbstractMessageConnector

stop

public void stop()
Description copied from interface: MessageConnectorMBean
Stops connector (connection is immediately dropped). Does nothing if connector is stopped.

Specified by:
stop in interface MessageConnectorMBean
Specified by:
stop in class AbstractMessageConnector

isActive

public boolean isActive()
Description copied from interface: MessageConnectorMBean
Returns true if connector is started (not stopped).

Specified by:
isActive in interface MessageConnectorMBean
Returns:
true if connector is started (not stopped)

getState

public MessageConnectorState getState()
Description copied from interface: MessageConnectorMBean
Returns message connector state.

Specified by:
getState in interface MessageConnectorMBean
Returns:
message connector state.

getConnectionCount

public int getConnectionCount()
Description copied from interface: MessageConnectorMBean
Returns number of established connections.

Specified by:
getConnectionCount in interface MessageConnectorMBean
Returns:
number of established connections

getEndpointStats

public com.devexperts.transport.stats.EndpointStats getEndpointStats()
Description copied from interface: MessageConnectorMBean
Returns statistics for this message connector.

Specified by:
getEndpointStats in interface MessageConnectorMBean
Overrides:
getEndpointStats in class AbstractMessageConnector
Returns:
statistics for this message connector

getAddress

public java.lang.String getAddress()
Description copied from interface: MessageConnectorMBean
Returns address string of this connector. It is "[host1[:port1],host2[:port2],...]:port" for client socket connector and ":port" for server socket connector.

Specified by:
getAddress in interface MessageConnectorMBean
Returns:
address string of this connector

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in interface NioServerConnectorMBean

setLocalPort

public void setLocalPort(int port)
Specified by:
setLocalPort in interface NioServerConnectorMBean

getSocketTimeout

public int getSocketTimeout()

setSocketTimeout

public void setSocketTimeout(int socketTimeout)

getBindAddr

public java.lang.String getBindAddr()
Specified by:
getBindAddr in interface NioServerConnectorMBean

setBindAddr

public void setBindAddr(java.lang.String newBindAddress)
                 throws java.net.UnknownHostException
Specified by:
setBindAddr in interface NioServerConnectorMBean
Throws:
java.net.UnknownHostException

setStats

public void setStats(QDStats stats)
Description copied from interface: MessageConnector
Changes QDStats associated with this message connector.

Specified by:
setStats in interface MessageConnector
Overrides:
setStats in class AbstractMessageConnector