public class TcpProxyService extends Object implements TcpProxyServiceMBean
Modifier and Type | Field and Description |
---|---|
private boolean |
activated |
(package private) String |
address |
(package private) int |
backlog |
static String |
BACKLOG_PROP
Name the property that allow to fix the TCP BACKLOG property for the
client's connections.
|
(package private) static boolean |
cnxWithNoAckedQueue |
private TcpConnectionListener[] |
connectionListeners
The thread listening to incoming
TCP connections.
|
private Vector |
connections
The list of opened connections
|
static int |
DEFAULT_BACKLOG
Default value for the TCP BACKLOG property.
|
static String |
DEFAULT_BINDADDRESS
Default IP address for binding the listen socket.
|
static int |
DEFAULT_POOL_SIZE
Default value for the pool size.
|
static int |
DEFAULT_PORT
Default value for the TCP port of the listen socket.
|
static int |
DEFAULT_SO_TIMEOUT
Default value for the TCP SO_TIMEOUT property.
|
static ExecutorService |
executorService |
static org.objectweb.util.monolog.api.Logger |
logger
logger
|
private static String |
MBEAN_NAME |
static String |
POOL_SIZE_PROP
Name the property that allow to fix the pool size for the
connection's listener.
|
(package private) int |
port |
private static TcpProxyService |
proxyService
The proxy service reference (used to stop it).
|
private ServerSocket |
serverSocket
The server socket listening to connections from the JMS clients.
|
static String |
SO_TIMEOUT_PROP
Name the property that allow to fix the TCP SO_TIMEOUT property for the
client's connections.
|
Constructor and Description |
---|
TcpProxyService(int port,
int backlog,
String address) |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Activates the connection manager.
|
void |
closeAllConnections()
Closes all opened connections.
|
static void |
createExecutors() |
protected ServerSocket |
createServerSocket(int port,
int backlog,
String address)
Initialize the listening socket.
|
void |
deactivate()
Deactivates the connection manager.
|
static void |
execute(Runnable command) |
(package private) TcpConnection |
getConnection(AgentId proxyId,
int key) |
int |
getFailedLoginCount()
Gets the number of connections rejected due to a failed authentication.
|
int |
getInitiatedConnectionCount()
Gets the number of initiated connections since server start.
|
String |
getMBeanName()
Gets the name of the MBean.
|
int |
getProtocolErrorCount()
Gets the number of connections rejected due to a wrong protocol header.
|
int |
getRunningConnectionsCount()
Gets the number of living connections.
|
String |
getServerAddress()
Gets the socket address of the server.
|
(package private) ServerSocket |
getServerSocket()
Gets the listening socket.
|
int |
getTcpListenersPoolSize()
Gets the number of threads listening for incoming tcp connections.
|
static void |
init(String args,
boolean firstTime)
Initializes the TCP entry point by creating a server socket listening
to the specified port.
|
boolean |
isActivated()
Tells if the ConnectionManager is active.
|
(package private) void |
registerConnection(TcpConnection tcpConnection) |
static void |
removeExecutors() |
protected void |
resetServerSocket()
Closes the listening socket and sets the variable to null.
|
protected void |
start() |
private void |
stop() |
static void |
stopService()
Stops the service.
|
(package private) void |
unregisterConnection(TcpConnection tcpConnection) |
public static org.objectweb.util.monolog.api.Logger logger
public static final String SO_TIMEOUT_PROP
public static final int DEFAULT_SO_TIMEOUT
public static final String POOL_SIZE_PROP
public static final int DEFAULT_POOL_SIZE
public static final String BACKLOG_PROP
public static final int DEFAULT_BACKLOG
public static final int DEFAULT_PORT
public static final String DEFAULT_BINDADDRESS
private static final String MBEAN_NAME
private static TcpProxyService proxyService
public static ExecutorService executorService
static boolean cnxWithNoAckedQueue
int port
int backlog
String address
private ServerSocket serverSocket
private Vector connections
private TcpConnectionListener[] connectionListeners
private boolean activated
ServerSocket getServerSocket()
protected void resetServerSocket()
protected ServerSocket createServerSocket(int port, int backlog, String address) throws Exception
port
- backlog
- address
- Exception
public static void init(String args, boolean firstTime) throws Exception
args
- stringified listening portfirstTime
- true
when the agent server starts.Exception
public static void stopService()
protected void start()
public String getMBeanName()
ConnectionManagerMBean
getMBeanName
in interface ConnectionManagerMBean
void registerConnection(TcpConnection tcpConnection)
void unregisterConnection(TcpConnection tcpConnection)
TcpConnection getConnection(AgentId proxyId, int key)
private void stop()
public void activate()
ConnectionManagerMBean
activate
in interface ConnectionManagerMBean
public static void createExecutors()
public static void removeExecutors()
public void closeAllConnections()
ConnectionManagerMBean
closeAllConnections
in interface ConnectionManagerMBean
public void deactivate()
ConnectionManagerMBean
deactivate
in interface ConnectionManagerMBean
public boolean isActivated()
ConnectionManagerMBean
isActivated
in interface ConnectionManagerMBean
public int getRunningConnectionsCount()
ConnectionManagerMBean
getRunningConnectionsCount
in interface ConnectionManagerMBean
public int getTcpListenersPoolSize()
TcpProxyServiceMBean
getTcpListenersPoolSize
in interface TcpProxyServiceMBean
public String getServerAddress()
TcpProxyServiceMBean
getServerAddress
in interface TcpProxyServiceMBean
public int getFailedLoginCount()
ConnectionManagerMBean
getFailedLoginCount
in interface ConnectionManagerMBean
public int getInitiatedConnectionCount()
ConnectionManagerMBean
getInitiatedConnectionCount
in interface ConnectionManagerMBean
public int getProtocolErrorCount()
TcpProxyServiceMBean
getProtocolErrorCount
in interface TcpProxyServiceMBean
Copyright © 2013 ScalAgent D.T.. All Rights Reserved.