Interface ServerSession
-
public interface ServerSessionAServerSessionobject is an application server object that is used by a server to associate a thread with a JMS session (optional).A
ServerSessionimplements two methods:getSession- returns theServerSession's JMS session.start- starts the execution of theServerSessionthread and results in the execution of the JMS session'srunmethod.
A
ConnectionConsumerimplemented by a JMS provider uses aServerSessionto process one or more messages that have arrived. It does this by getting aServerSessionfrom theConnectionConsumer'sServerSessionPool; getting theServerSession's JMS session; loading it with the messages; and then starting theServerSession.In most cases the
ServerSessionwill register some object it provides as theServerSession's thread run object. TheServerSession'sstartmethod will call the thread'sstartmethod, which will start the new thread, and from it, call therunmethod of theServerSession's run object. This object will do some housekeeping and then call theSession'srunmethod. Whenrunreturns, theServerSession's run object can return theServerSessionto theServerSessionPool, and the cycle starts again.Note that the JMS API does not architect how the
ConnectionConsumerloads theSessionwith messages. Since both theConnectionConsumerandSessionare implemented by the same JMS provider, they can accomplish the load using a private mechanism.- See Also:
ServerSessionPool,ConnectionConsumer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SessiongetSession()Return theServerSession'sSession.voidstart()Cause theSession'srunmethod to be called to process messages that were just assigned to it.
-
-
-
Method Detail
-
getSession
Session getSession() throws JMSException
Return theServerSession'sSession. This must be aSessioncreated by the sameConnectionthat will be dispatching messages to it. The provider will assign one or more messages to theSessionand then callstarton theServerSession.- Returns:
- the server session's session
- Throws:
JMSException- if the JMS provider fails to get the associated session for thisServerSessiondue to some internal error.
-
start
void start() throws JMSExceptionCause theSession'srunmethod to be called to process messages that were just assigned to it.- Throws:
JMSException- if the JMS provider fails to start the server session to process messages due to some internal error.
-
-