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 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 TcpProxyService (TCP/JMS connector), creates the socket and starts listeners.
|
void |
closeAllConnections()
Closes all active connections.
|
static void |
createExecutors() |
protected ServerSocket |
createServerSocket(int port,
int backlog,
String address)
Initialize the listening socket.
|
void |
deactivate()
Deactivates the TcpProxyService (TCP/JMS connector), stops all listeners.
|
static void |
execute(Runnable command) |
(package private) TcpConnection |
getConnection(AgentId proxyId,
int key) |
int |
getFailedLoginCount()
Gets the number of failed login.
|
int |
getInitiatedConnectionCount()
Gets the number of connections initiated since boot time.
|
int |
getListenPort()
Gets the listen port of the server.
|
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 active 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.
|
String |
getVersion()
Gets the name of the MBean.
|
static void |
init(String args,
boolean firstTime)
Initializes the TCP entry point by creating a server socket listening
to the specified port.
|
boolean |
isActivated()
Returns true if the TcpProxyService (TCP/JMS connector) is started.
|
(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 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 String getVersion()
ConnectionManagerMBean
getVersion
in interface ConnectionManagerMBean
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()
activate
in interface ConnectionManagerMBean
activate
in interface TcpProxyServiceMBean
public static void createExecutors()
public static void removeExecutors()
public void closeAllConnections()
closeAllConnections
in interface ConnectionManagerMBean
closeAllConnections
in interface TcpProxyServiceMBean
public void deactivate()
deactivate
in interface ConnectionManagerMBean
deactivate
in interface TcpProxyServiceMBean
public boolean isActivated()
isActivated
in interface ConnectionManagerMBean
isActivated
in interface TcpProxyServiceMBean
public int getRunningConnectionsCount()
getRunningConnectionsCount
in interface ConnectionManagerMBean
getRunningConnectionsCount
in interface TcpProxyServiceMBean
public int getTcpListenersPoolSize()
getTcpListenersPoolSize
in interface TcpProxyServiceMBean
public int getListenPort()
getListenPort
in interface TcpProxyServiceMBean
public String getServerAddress()
getServerAddress
in interface TcpProxyServiceMBean
public int getFailedLoginCount()
getFailedLoginCount
in interface ConnectionManagerMBean
getFailedLoginCount
in interface TcpProxyServiceMBean
public int getInitiatedConnectionCount()
getInitiatedConnectionCount
in interface ConnectionManagerMBean
getInitiatedConnectionCount
in interface TcpProxyServiceMBean
public int getProtocolErrorCount()
getProtocolErrorCount
in interface TcpProxyServiceMBean
Copyright © 2022 ScalAgent D.T.. All rights reserved.