Package org.objectweb.joram.mom.proxies
Class ConnectionManager
- java.lang.Object
-
- org.objectweb.joram.mom.proxies.ConnectionManager
-
- All Implemented Interfaces:
ConnectionManagerMBean
public class ConnectionManager extends Object implements ConnectionManagerMBean
AConnectionManageris started as a service in each MOM agent server for allowing connections with external clients.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanactivatedtrueif new connections are accepted.static StringCTRLFLOW_THRESHOLDName of property allowing to define the threshold beyond which the flow-control of incoming messages is activated.static StringCTRLFLOW_THROUGHPUTName of property allowing to define the average throughput of the server for the calculation of flow control.private static longctrlFlowDelayDefinition of average delay for the implementation of flow control (it is computed from the CTRLFLOW_THROUGHPUT parameter.private static intctrlFlowThresholdThreshold beyond which the flow-control of incoming messages is activated.private static ConnectionManagercurrentInstanceUnique ConnectionManager instance.private static booleanDEBUGstatic StringDIRECT_NOTIFICATIONprivate static booleandirectNotificationstatic intinFlowLimit of incoming messages flow (msgs/s) requested if any, default value is -1 (no limitation).private static Loggerloggerloggerprivate List<ConnectionManagerMBean>managersList of registered managers (tcp, ssl, local, ...)private static StringMBEAN_NAMEstatic StringMULTI_CNX_SYNCName of property allowing to activate the synchronization mode of multiples connections.static StringMULTI_CNX_SYNC_DELAYName of property allowing to configure the synchronization mode of multiples connections.private static booleanmultiCnxSyncTrue if the synchronization mode is activated.private static Hashtable<AgentId,MultiCnxSync>multiCnxSyncTableprivate static longmultiThreadSyncDelayDuration in ms of instant to pack the commands.static Stringversion
-
Constructor Summary
Constructors Constructor Description ConnectionManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()Activates the connection manager.voidaddManager(ConnectionManagerMBean manager)Registers a new manager.booleancheckCredentials(String userName, String password)Checks the validity of the given name and password.voidcloseAllConnections()Closes all opened connections.private static CountDownCallbackcreateCallback(AbstractJmsRequest req, ConnectionContext ctx)private static IdentitycreateIdentity(String adminName, String adminPassword, String identityClassName)Create an admin Identity.voiddeactivate()Deactivates the connection manager.private static voidflowControl()static ConnectionManagergetCurrentInstance()intgetFailedLoginCount()Gets the number of connections rejected due to a failed authentication.intgetInitiatedConnectionCount()Gets the number of initiated connections since server start.StringgetMBeanName()Gets the name of the MBean.static MultiCnxSyncgetMultiCnxSync(AgentId proxyId)static longgetMultiThreadSyncDelay()intgetRunningConnectionsCount()Gets the number of living connections.StringgetVersion()Gets the name of the MBean.static voidinit(String args, boolean firstTime)Initializes the connection manager as a service.booleanisActivated()Tells if the ConnectionManager is active.static voidregisterFactories()private voidremoveAllManagers()voidremoveManager(ConnectionManagerMBean manager)Removes a registered manager.static voidsendToProxy(AgentId proxyId, int cnxKey, AbstractJmsRequest req, Object msg, ConnectionContext ctx)static voidsetActivate(boolean activate)Activates/deactivates the connection manager.static voidstopService()Stops theConnectionManagerservice.
-
-
-
Field Detail
-
logger
private static final Logger logger
logger
-
DEBUG
private static final boolean DEBUG
-
MULTI_CNX_SYNC
public static final String MULTI_CNX_SYNC
Name of property allowing to activate the synchronization mode of multiples connections.This mode allows to pack commands that occurs in a same time in order to minimize the number of transactions.
This property can be fixed either from
javalaunching command or a3servers.xml configuration file.- See Also:
- Constant Field Values
-
multiCnxSync
private static boolean multiCnxSync
True if the synchronization mode is activated.
-
MULTI_CNX_SYNC_DELAY
public static final String MULTI_CNX_SYNC_DELAY
Name of property allowing to configure the synchronization mode of multiples connections.This property allows to define the duration of instant to pack the commands.
This property can be fixed either from
javalaunching command or a3servers.xml configuration file.- See Also:
- Constant Field Values
-
multiThreadSyncDelay
private static long multiThreadSyncDelay
Duration in ms of instant to pack the commands.
-
CTRLFLOW_THRESHOLD
public static final String CTRLFLOW_THRESHOLD
Name of property allowing to define the threshold beyond which the flow-control of incoming messages is activated. Default value is 25.This property can be fixed either from
javalaunching command or a3servers.xml configuration file.- See Also:
- Constant Field Values
-
ctrlFlowThreshold
private static int ctrlFlowThreshold
Threshold beyond which the flow-control of incoming messages is activated.
-
CTRLFLOW_THROUGHPUT
public static final String CTRLFLOW_THROUGHPUT
Name of property allowing to define the average throughput of the server for the calculation of flow control. Default value is 100000.This property can be fixed either from
javalaunching command or a3servers.xml configuration file.- See Also:
- Constant Field Values
-
ctrlFlowDelay
private static long ctrlFlowDelay
Definition of average delay for the implementation of flow control (it is computed from the CTRLFLOW_THROUGHPUT parameter.
-
DIRECT_NOTIFICATION
public static final String DIRECT_NOTIFICATION
- See Also:
- Constant Field Values
-
directNotification
private static boolean directNotification
-
MBEAN_NAME
private static final String MBEAN_NAME
- See Also:
- Constant Field Values
-
activated
private boolean activated
trueif new connections are accepted.
-
managers
private List<ConnectionManagerMBean> managers
List of registered managers (tcp, ssl, local, ...)
-
currentInstance
private static ConnectionManager currentInstance
Unique ConnectionManager instance.
-
multiCnxSyncTable
private static Hashtable<AgentId,MultiCnxSync> multiCnxSyncTable
-
inFlow
public static final int inFlow
Limit of incoming messages flow (msgs/s) requested if any, default value is -1 (no limitation). This value can be adjusted by setting ConnectionManager.inFlow property. This property can be fixed either fromjavalaunching command, or ina3servers.xmlconfiguration file.
-
version
public static final String version
-
-
Method Detail
-
registerFactories
public static final void registerFactories()
-
createCallback
private static CountDownCallback createCallback(AbstractJmsRequest req, ConnectionContext ctx)
-
flowControl
private static void flowControl()
-
sendToProxy
public static final void sendToProxy(AgentId proxyId, int cnxKey, AbstractJmsRequest req, Object msg, ConnectionContext ctx)
-
getMultiThreadSyncDelay
public static final long getMultiThreadSyncDelay()
-
getMultiCnxSync
public static MultiCnxSync getMultiCnxSync(AgentId proxyId)
-
getVersion
public String getVersion()
Description copied from interface:ConnectionManagerMBeanGets the name of the MBean.- Specified by:
getVersionin interfaceConnectionManagerMBean
-
init
public static void init(String args, boolean firstTime) throws Exception
Initializes the connection manager as a service. Creates and deploys the administration topic, the connection manager agent and if requested the administration user proxy.- Parameters:
args- name and password of the administrator (optional).firstTime-truewhen the agent server starts.- Throws:
Exception- Thrown when processing the String argument or in case of a problem when deploying the ConnectionFactory.
-
createIdentity
private static Identity createIdentity(String adminName, String adminPassword, String identityClassName) throws Exception
Create an admin Identity.- Parameters:
adminName- Name of the admin.adminPassword- Password of the admin.identityClassName- identity class name.- Returns:
- identity admin Identity.
- Throws:
Exception
-
stopService
public static void stopService()
Stops theConnectionManagerservice.
-
activate
public void activate()
Description copied from interface:ConnectionManagerMBeanActivates the connection manager. Creation of new connections will be allowed.- Specified by:
activatein interfaceConnectionManagerMBean
-
closeAllConnections
public void closeAllConnections()
Description copied from interface:ConnectionManagerMBeanCloses all opened connections.- Specified by:
closeAllConnectionsin interfaceConnectionManagerMBean
-
deactivate
public void deactivate()
Description copied from interface:ConnectionManagerMBeanDeactivates the connection manager. No new connection will be opened.- Specified by:
deactivatein interfaceConnectionManagerMBean
-
getRunningConnectionsCount
public int getRunningConnectionsCount()
Description copied from interface:ConnectionManagerMBeanGets the number of living connections.- Specified by:
getRunningConnectionsCountin interfaceConnectionManagerMBean- Returns:
- the number of living connections.
-
isActivated
public boolean isActivated()
Description copied from interface:ConnectionManagerMBeanTells if the ConnectionManager is active.- Specified by:
isActivatedin interfaceConnectionManagerMBean- Returns:
- ConnectionManager's active state.
-
getCurrentInstance
public static ConnectionManager getCurrentInstance()
-
addManager
public void addManager(ConnectionManagerMBean manager)
Registers a new manager.
-
removeManager
public void removeManager(ConnectionManagerMBean manager)
Removes a registered manager.
-
removeAllManagers
private void removeAllManagers()
-
getMBeanName
public String getMBeanName()
Description copied from interface:ConnectionManagerMBeanGets the name of the MBean.- Specified by:
getMBeanNamein interfaceConnectionManagerMBean
-
getFailedLoginCount
public int getFailedLoginCount()
Description copied from interface:ConnectionManagerMBeanGets the number of connections rejected due to a failed authentication.- Specified by:
getFailedLoginCountin interfaceConnectionManagerMBean- Returns:
- the number of connections rejected due to a failed authentication.
-
getInitiatedConnectionCount
public int getInitiatedConnectionCount()
Description copied from interface:ConnectionManagerMBeanGets the number of initiated connections since server start.- Specified by:
getInitiatedConnectionCountin interfaceConnectionManagerMBean- Returns:
- the number of initiated connection.
-
checkCredentials
public boolean checkCredentials(String userName, String password)
Checks the validity of the given name and password.- Parameters:
userName- the name of the userpassword- the password of the user- Returns:
trueif the name and password match an existing user.
-
setActivate
public static void setActivate(boolean activate)
Activates/deactivates the connection manager.- Parameters:
activate- true, activates the connection manager.
-
-