public class JmsMatsJmsSessionHandler_Pooling extends java.lang.Object implements JmsMatsJmsSessionHandler, JmsMatsStatics
JmsMatsJmsSessionHandler
- upon
creation
, you decide how
Connections are shared for JmsMatsStageProcessor
s and MatsInitiator
s.Modifier and Type | Class and Description |
---|---|
protected class |
JmsMatsJmsSessionHandler_Pooling.ConnectionWithSessionPool |
static class |
JmsMatsJmsSessionHandler_Pooling.JmsSessionHolderImpl |
static class |
JmsMatsJmsSessionHandler_Pooling.PoolingKeyInitiator
What kind of sharing of JMS Connections to employ for a
JmsMatsInitiator . |
static class |
JmsMatsJmsSessionHandler_Pooling.PoolingKeyStageProcessor
What kind of sharing of JMS Connections to employ for a
JmsMatsStageProcessor . |
JmsMatsJmsSessionHandler.JmsSessionHolder
Modifier and Type | Field and Description |
---|---|
protected java.util.IdentityHashMap<java.lang.Object,JmsMatsJmsSessionHandler_Pooling.ConnectionWithSessionPool> |
_connectionWithSessionPools_crashed |
protected java.util.IdentityHashMap<java.lang.Object,JmsMatsJmsSessionHandler_Pooling.ConnectionWithSessionPool> |
_connectionWithSessionPools_live |
protected javax.jms.ConnectionFactory |
_jmsConnectionFactory |
protected JmsMatsJmsSessionHandler_Pooling.PoolingKeyInitiator |
_poolingKeyInitiator |
protected JmsMatsJmsSessionHandler_Pooling.PoolingKeyStageProcessor |
_poolingKeyStageProcessor |
EXTRA_GRACE_MILLIS, ILLEGAL_CALL_FLOWS, JMS_MSG_PROP_AUDIT, JMS_MSG_PROP_DISPATCH_TYPE, JMS_MSG_PROP_FROM, JMS_MSG_PROP_INITIALIZING_APP, JMS_MSG_PROP_INITIATOR_ID, JMS_MSG_PROP_MATS_MESSAGE_ID, JMS_MSG_PROP_MESSAGE_TYPE, JMS_MSG_PROP_TO, JMS_MSG_PROP_TRACE_ID, LOG_PREFIX, MAX_STACK_HEIGHT, MAX_TOTAL_CALL_NUMBER, MDC_MATS_APP_NAME, MDC_MATS_APP_VERSION, MDC_MATS_CALL_NUMBER, MDC_MATS_IN_MESSAGE_SYSTEM_ID, MDC_MATS_INIT, MDC_MATS_OUT_MATS_MESSAGE_ID, MDC_MATS_STAGE, MDC_MATS_STAGE_ID, MDC_MATS_STAGE_INDEX, MDC_TRACE_ID, NO_INVOCATION_POINT, RANDOM_ALPHABET, THREAD_PREFIX, TOTAL_JMS_MSG_PROPS_SIZE
Modifier | Constructor and Description |
---|---|
protected |
JmsMatsJmsSessionHandler_Pooling(javax.jms.ConnectionFactory jmsConnectionFactory,
JmsMatsJmsSessionHandler_Pooling.PoolingKeyInitiator poolingKeyInitiator,
JmsMatsJmsSessionHandler_Pooling.PoolingKeyStageProcessor poolingKeyStageProcessor) |
Modifier and Type | Method and Description |
---|---|
int |
closeAllAvailableSessions()
Closes all Available Session, does not touch Employed.
|
static JmsMatsJmsSessionHandler_Pooling |
create(javax.jms.ConnectionFactory jmsConnectionFactory)
Returns a JmsMatsJmsSessionHandler which uses the
INITIATOR pooling key for
Intitiators (i.e. |
static JmsMatsJmsSessionHandler_Pooling |
create(javax.jms.ConnectionFactory jmsConnectionFactory,
JmsMatsJmsSessionHandler_Pooling.PoolingKeyInitiator poolingKeyInitiator,
JmsMatsJmsSessionHandler_Pooling.PoolingKeyStageProcessor poolingKeyStageProcessor)
Returns a JmsMatsJmsSessionHandler which have specific pooling derivation.
|
protected java.lang.Object |
derivePoolingKey(JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey) |
protected JmsMatsJmsSessionHandler.JmsSessionHolder |
getSessionHolder_internal(JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey) |
JmsMatsJmsSessionHandler.JmsSessionHolder |
getSessionHolder(io.mats3.impl.jms.JmsMatsInitiator<?> initiator)
Will be invoked every time an Initiator wants to send a message - it will be returned after the message(s) is
sent.
|
JmsMatsJmsSessionHandler.JmsSessionHolder |
getSessionHolder(io.mats3.impl.jms.JmsMatsStageProcessor<?,?,?,?> stageProcessor)
Will be invoked before the StageProcessor goes into its consumer loop - it will be closed once the Stage is
stopped, or if the Session "crashes", i.e.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createFlowId, getInvocationPoint, handleIncomingMessageMatsObject, handleIncomingState, id, id, idThis, ms3, produceAndSendMsgSysMessages, randomString, setConcurrencyWithLog, stageOrInit
protected final javax.jms.ConnectionFactory _jmsConnectionFactory
protected final JmsMatsJmsSessionHandler_Pooling.PoolingKeyInitiator _poolingKeyInitiator
protected final JmsMatsJmsSessionHandler_Pooling.PoolingKeyStageProcessor _poolingKeyStageProcessor
protected java.util.IdentityHashMap<java.lang.Object,JmsMatsJmsSessionHandler_Pooling.ConnectionWithSessionPool> _connectionWithSessionPools_live
protected java.util.IdentityHashMap<java.lang.Object,JmsMatsJmsSessionHandler_Pooling.ConnectionWithSessionPool> _connectionWithSessionPools_crashed
protected JmsMatsJmsSessionHandler_Pooling(javax.jms.ConnectionFactory jmsConnectionFactory, JmsMatsJmsSessionHandler_Pooling.PoolingKeyInitiator poolingKeyInitiator, JmsMatsJmsSessionHandler_Pooling.PoolingKeyStageProcessor poolingKeyStageProcessor)
protected java.lang.Object derivePoolingKey(JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey)
public static JmsMatsJmsSessionHandler_Pooling create(javax.jms.ConnectionFactory jmsConnectionFactory)
INITIATOR
pooling key for
Intitiators (i.e. a JMS Connection per Initiator), and FACTORY
pooling
key for Endpoints (i.e. a JMS Connection per Endpoint).
Note that is seems like ActiveMQ is not all that great at multiplexing multiple sessions and consumers over the
same connection. You get lower latency by using STAGE
and even better with
STAGE_PROCESSOR
, but when your set of services using Mats gets
large, this results in an awful lot of connections.jmsConnectionFactory
- the JMS ConnectionFactory
to get JMS Connections from.public static JmsMatsJmsSessionHandler_Pooling create(javax.jms.ConnectionFactory jmsConnectionFactory, JmsMatsJmsSessionHandler_Pooling.PoolingKeyInitiator poolingKeyInitiator, JmsMatsJmsSessionHandler_Pooling.PoolingKeyStageProcessor poolingKeyStageProcessor)
jmsConnectionFactory
- the JMS ConnectionFactory
to get JMS Connections from.poolingKeyInitiator
- what kind of JMS Connection sharing to employ for Initiators.poolingKeyStageProcessor
- what kind of JMS Connection sharing to employ for StageProcessors.public JmsMatsJmsSessionHandler.JmsSessionHolder getSessionHolder(io.mats3.impl.jms.JmsMatsInitiator<?> initiator) throws JmsMatsException.JmsMatsJmsException
JmsMatsJmsSessionHandler
getSessionHolder
in interface JmsMatsJmsSessionHandler
initiator
- the initiator in question.JmsMatsJmsSessionHandler.JmsSessionHolder
instance - which is not the same as any other SessionHolders concurrently in
use (but it may be pooled, so after a JmsMatsJmsSessionHandler.JmsSessionHolder.release()
, it may be returned to another
invocation again).JmsMatsException.JmsMatsJmsException
- if there was a problem getting a Connection. Problems getting a Sessions (e.g. the current Connection
is broken) should be internally handled (i.e. try to get a new Connection), except if it can be
determined that the problem getting a Session is of a fundamental nature (i.e. the credentials can
get a Connection, but cannot get a Session - which would be pretty absurd, but hey).public JmsMatsJmsSessionHandler.JmsSessionHolder getSessionHolder(io.mats3.impl.jms.JmsMatsStageProcessor<?,?,?,?> stageProcessor) throws JmsMatsException.JmsMatsJmsException
JmsMatsJmsSessionHandler
getSessionHolder
in interface JmsMatsJmsSessionHandler
stageProcessor
- the StageProcessor in question.JmsMatsJmsSessionHandler.JmsSessionHolder
instance - which is unique for each call.JmsMatsException.JmsMatsJmsException
- if there was a problem getting a Connection. Problems getting a Sessions (e.g. the current Connection
is broken) should be internally handled (i.e. try to get a new Connection), except if it can be
determined that the problem getting a Session is of a fundamental nature (i.e. the credentials can
get a Connection, but cannot get a Session - which would be pretty absurd, but hey).public int closeAllAvailableSessions()
JmsMatsJmsSessionHandler
JmsMatsJmsSessionHandler
upon shutdown - the returned value is a count of how many Connections are still
alive after the operation, which should be 0.closeAllAvailableSessions
in interface JmsMatsJmsSessionHandler
protected JmsMatsJmsSessionHandler.JmsSessionHolder getSessionHolder_internal(JmsMatsTransactionManager.JmsMatsTxContextKey txContextKey) throws JmsMatsException.JmsMatsJmsException