Class RequestMultiplexer
- java.lang.Object
-
- org.objectweb.joram.client.jms.connection.RequestMultiplexer
-
public class RequestMultiplexer extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classRequestMultiplexer.Closerprivate classRequestMultiplexer.DemultiplexerDaemonprivate classRequestMultiplexer.HeartBeatTaskTimer task responsible for sending a ping message to the server if no request has been sent during the specified timeout ('cnxPendingTimer' from the factory parameters).(package private) classRequestMultiplexer.onExceptionRunnerprivate static classRequestMultiplexer.Status
-
Field Summary
Fields Modifier and Type Field Description private RequestChannelchannelprivate Connectioncnxprivate Map<Integer,CompletionListener>completionListenersprivate RequestMultiplexer.DemultiplexerDaemondemtpxprivate ExceptionListenerexceptionListenerprivate RequestMultiplexer.HeartBeatTaskheartBeatTaskThe task responsible for keeping the connection alive.private longlastRequestDateThe date of the last requestprivate static org.objectweb.util.monolog.api.Loggerloggerprivate intrequestCounterprivate Map<Integer,ReplyListener>requestsTable(package private) CompletionListenerrunningCLprivate intstatusprivate static Timertimerprivate static inttimerInUse
-
Constructor Summary
Constructors Constructor Description RequestMultiplexer(Connection cnx, RequestChannel channel, long heartBeat)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidabortReply(org.objectweb.joram.shared.client.AbstractJmsReply reply)voidabortRequest(int requestId)Not synchronized because it would possibly deadlock with some reply listeners (actually requestors).static JMSExceptionbuildJmsException(org.objectweb.joram.shared.client.MomExceptionReply excReply)Converts aMomExceptionReplyto the correspondingJMSException.private static voidcancelTimer()booleancheckCLMessageProducer(Session session, MessageProducer mp)booleancheckCLSession(Session session)booleancheckDemultiplexerDaemon()voidcleanup()Aborts all running requests.voidclose()Not synchronized because it would possibly deadlock with some reply listeners (actually requestors).voidclosing()private static voidcreateTimer()voiddeny(org.objectweb.joram.shared.client.ConsumerMessages messages)voiddenyRequest(org.objectweb.joram.shared.client.ConsumerReceiveRequest request)private ReplyListenerdoAbortRequest(int requestId)StringgetDemultiplexerDaemonName()ExceptionListenergetExceptionListener()private static TimergetTimer()booleanisClosed()private voidonException(Exception exc)voidreplyAllError(org.objectweb.joram.shared.client.MomExceptionReply exc)private voidroute(org.objectweb.joram.shared.client.AbstractJmsReply reply, boolean isCompletionListener)Not synchronized because it may be called by the demultiplexer during a concurrent close.voidschedule(TimerTask task, long period)voidsendRequest(org.objectweb.joram.shared.client.AbstractJmsRequest request)voidsendRequest(org.objectweb.joram.shared.client.AbstractJmsRequest request, ReplyListener listener, CompletionListener completionListener)voidsetDemultiplexerDaemonName(String name)voidsetExceptionListener(ExceptionListener exceptionListener)voidsetMultiThreadSync(int delay, int threshold)private voidsetStatus(int status)
-
-
-
Field Detail
-
logger
private static org.objectweb.util.monolog.api.Logger logger
-
cnx
private Connection cnx
-
status
private volatile int status
-
channel
private RequestChannel channel
-
requestsTable
private Map<Integer,ReplyListener> requestsTable
-
completionListeners
private Map<Integer,CompletionListener> completionListeners
-
requestCounter
private int requestCounter
-
demtpx
private RequestMultiplexer.DemultiplexerDaemon demtpx
-
timer
private static Timer timer
-
timerInUse
private static int timerInUse
-
heartBeatTask
private RequestMultiplexer.HeartBeatTask heartBeatTask
The task responsible for keeping the connection alive.
-
exceptionListener
private ExceptionListener exceptionListener
-
lastRequestDate
private volatile long lastRequestDate
The date of the last request
-
runningCL
CompletionListener runningCL
-
-
Constructor Detail
-
RequestMultiplexer
public RequestMultiplexer(Connection cnx, RequestChannel channel, long heartBeat) throws JMSException
- Throws:
JMSException
-
-
Method Detail
-
buildJmsException
public static JMSException buildJmsException(org.objectweb.joram.shared.client.MomExceptionReply excReply)
Converts aMomExceptionReplyto the correspondingJMSException.- Parameters:
excReply- the MOM reply to convert- Returns:
- the corresponding Exception
-
checkDemultiplexerDaemon
public boolean checkDemultiplexerDaemon()
-
checkCLSession
public boolean checkCLSession(Session session)
-
checkCLMessageProducer
public boolean checkCLMessageProducer(Session session, MessageProducer mp)
-
createTimer
private static void createTimer()
-
cancelTimer
private static void cancelTimer()
-
getTimer
private static Timer getTimer()
-
setStatus
private void setStatus(int status)
-
isClosed
public boolean isClosed()
-
closing
public void closing()
-
setExceptionListener
public void setExceptionListener(ExceptionListener exceptionListener)
-
getExceptionListener
public ExceptionListener getExceptionListener()
-
sendRequest
public void sendRequest(org.objectweb.joram.shared.client.AbstractJmsRequest request) throws JMSException- Throws:
JMSException
-
sendRequest
public void sendRequest(org.objectweb.joram.shared.client.AbstractJmsRequest request, ReplyListener listener, CompletionListener completionListener) throws JMSException- Throws:
JMSException
-
setMultiThreadSync
public void setMultiThreadSync(int delay, int threshold)
-
close
public void close()
Not synchronized because it would possibly deadlock with some reply listeners (actually requestors).
-
cleanup
public void cleanup()
Aborts all running requests. Used by: 1- close() 2- the connector layer (OutboundConnection.cleanup())
-
replyAllError
public void replyAllError(org.objectweb.joram.shared.client.MomExceptionReply exc)
-
abortRequest
public void abortRequest(int requestId)
Not synchronized because it would possibly deadlock with some reply listeners (actually requestors).
-
doAbortRequest
private ReplyListener doAbortRequest(int requestId)
-
route
private void route(org.objectweb.joram.shared.client.AbstractJmsReply reply, boolean isCompletionListener)Not synchronized because it may be called by the demultiplexer during a concurrent close. It would deadlock as the close waits for the demultiplexer to stop.
-
abortReply
private void abortReply(org.objectweb.joram.shared.client.AbstractJmsReply reply)
-
deny
public void deny(org.objectweb.joram.shared.client.ConsumerMessages messages)
-
denyRequest
public void denyRequest(org.objectweb.joram.shared.client.ConsumerReceiveRequest request)
-
onException
private void onException(Exception exc)
-
schedule
public void schedule(TimerTask task, long period)
-
setDemultiplexerDaemonName
public void setDemultiplexerDaemonName(String name)
-
getDemultiplexerDaemonName
public String getDemultiplexerDaemonName()
-
-