Interface ServerSession
ServerSession
object is an application server object that is used by a server to associate a thread with a
Jakarta Messaging session (optional).
A ServerSession
implements two methods:
getSession
- returns theServerSession
's Jakarta Messaging session.start
- starts the execution of theServerSession
thread and results in the execution of the JMS session'srun
method.
A ConnectionConsumer
implemented by a Jakarta Messaging provider uses a ServerSession
to process one or more
messages that have arrived. It does this by getting a ServerSession
from the ConnectionConsumer
's
ServerSessionPool
; getting the ServerSession
's Jakarta Messaging session; loading it with the messages; and then
starting the ServerSession
.
In most cases the ServerSession
will register some object it provides as the ServerSession
's thread
run object. The ServerSession
's start
method will call the thread's start
method, which will
start the new thread, and from it, call the run
method of the ServerSession
's run object. This object
will do some housekeeping and then call the Session
's run
method. When run
returns, the
ServerSession
's run object can return the ServerSession
to the ServerSessionPool
, and the
cycle starts again.
Note that the Jakarta Messaging API does not architect how the ConnectionConsumer
loads the Session
with messages.
Since both the ConnectionConsumer
and Session
are implemented by the same Jakarta Messaging provider, they can
accomplish the load using a private mechanism.
- Since:
- JMS 1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturn theServerSession
'sSession
.void
start()
Cause theSession
'srun
method to be called to process messages that were just assigned to it.
-
Method Details
-
getSession
Return theServerSession
'sSession
. This must be aSession
created by the sameConnection
that will be dispatching messages to it. The provider will assign one or more messages to theSession
and then callstart
on theServerSession
.- Returns:
- the server session's session
- Throws:
JMSException
- if the Jakarta Messaging provider fails to get the associated session for thisServerSession
due to some internal error.
-
start
Cause theSession
'srun
method to be called to process messages that were just assigned to it.- Throws:
JMSException
- if the Jakarta Messaging provider fails to start the server session to process messages due to some internal error.
-