|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.jms Interface ServerSession
public interface ServerSession
ServerSession
对象是应用服务器对象,服务器使用该对象将线程与 JMS 会话关联(可选)。
ServerSession
实现两个方法:
getSession
- 返回ServerSession
的 JMS 会话。start
- 开始执行ServerSession
线程,并导致 JMS 会话的run
方法执行。
JMS 提供者实现的 ConnectionConsumer
使用 ServerSession
处理一个或多个到达的消息。它通过从 ConnectionConsumer
的 ServerSessionPool
获取 ServerSession
;获取 ServerSession
的 JMS 会话;使用消息加载 JMS 会话;然后启动 ServerSession
做到这一点。
在大多数情况下,ServerSession
会将它提供的某个对象注册为 ServerSession
的线程运行对象。ServerSession
的 start
方法将调用线程的 start
方法,从而启动新线程,然后从该线程调用 ServerSession
的运行对象的 run
方法。此对象将执行一些内务处理,然后调用 Session
的 run
方法。当 run
返回时,ServerSession
的运行对象可能将 ServerSession
返回到 ServerSessionPool
,然后再次开始循环。
注意,JMS API 没有架构 ConnectionConsumer
使用消息加载 Session
的方式。由于 ConnectionConsumer
和 Session
都是由相同的 JMS 提供者实现的,因此它们可以使用专有机制来完成加载。
version |
| |
See also | javax.jms.ServerSessionPool, javax.jms.ConnectionConsumer |
A ServerSession
object is an application server object that
is used by a server to associate a thread with a JMS session (optional).
A ServerSession
implements two methods:
getSession
- returns theServerSession
's JMS session.start
- starts the execution of theServerSession
thread and results in the execution of the JMS session'srun
method.
A ConnectionConsumer
implemented by a JMS 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 JMS 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 JMS API does not architect how the
ConnectionConsumer
loads the Session
with
messages. Since both the ConnectionConsumer
and
Session
are implemented by the same JMS provider, they can
accomplish the load using a private mechanism.
- Version:
- 1.0 - 9 March 1998
- Author:
- Mark Hapner, Rich Burridge
- See Also:
ServerSessionPool
,ConnectionConsumer
Method Summary | |
---|---|
Session |
getSession()
Return the ServerSession 's Session . |
void |
start()
Cause the Session 's run method to be called
to process messages that were just assigned to it. |
Method Detail |
---|
public Session
getSession() throws JMSException
返回 ServerSession
的 Session
。此会话必须是由将消息分派给它的那个 Connection
创建的 Session
。提供者将一个或多个消息分配给 Session
,然后调用 ServerSession
中的 start
。
return | 服务器会话的会话 |
Throws | JMSException:
如果 JMS 提供者由于某个内部错误无法获取与此 ServerSession 关联的会话。 |
getSession
Session getSession() throws JMSException
- Return the
ServerSession
'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 JMS provider fails to get the associated session for thisServerSession
due to some internal error.
public void
start() throws JMSException
导致调用 Session
的 run
方法来处理刚分配给它的消息。
Throws | JMSException: 如果 JMS 提供者由于某个内部错误无法启动服务器会话来处理消息。 |
start
void start() throws JMSException
- Cause the
Session
'srun
method 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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!