|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.jms Interface ConnectionConsumer
public interface ConnectionConsumer
Connection
对象为应用服务器提供了一个特殊工具来创建 ConnectionConsumer
(可选)。它要使用的消息通过 Destination
和消息选择器指定。此外,必须为 ConnectionConsumer
提供 ServerSessionPool
,用于处理它的消息。
通常,当流量少时,ConnectionConsumer
从其池中获取一个 ServerSession
,在其中加载一个消息,然后启动该会话。随着流量增多,消息可能会滞留。如果发生这种情况,ConnectionConsumer
可以在每个 ServerSession
中加载多个消息。这样减少了线程上下文切换并且最大限度地减少了资源使用,但代价是需要对消息处理进行一些序列化。
version |
| |
See also | createConnectionConsumer, createDurableConnectionConsumer, createConnectionConsumer, createConnectionConsumer, createDurableConnectionConsumer |
For application servers, Connection
objects provide a special
facility
for creating a ConnectionConsumer
(optional). The messages it
is to consume are
specified by a Destination
and a message selector. In addition,
a ConnectionConsumer
must be given a
ServerSessionPool
to use for
processing its messages.
Normally, when traffic is light, a ConnectionConsumer
gets a
ServerSession
from its pool, loads it with a single message, and
starts it. As traffic picks up, messages can back up. If this happens,
a ConnectionConsumer
can load each ServerSession
with more than one
message. This reduces the thread context switches and minimizes resource
use at the expense of some serialization of message processing.
- Version:
- 1.1 February 8, 2002
- Author:
- Mark Hapner, Rich Burridge
- See Also:
Connection.createConnectionConsumer(javax.jms.Destination, java.lang.String, javax.jms.ServerSessionPool, int)
,Connection.createDurableConnectionConsumer(javax.jms.Topic, java.lang.String, java.lang.String, javax.jms.ServerSessionPool, int)
,QueueConnection.createConnectionConsumer(javax.jms.Queue, java.lang.String, javax.jms.ServerSessionPool, int)
,TopicConnection.createConnectionConsumer(javax.jms.Topic, java.lang.String, javax.jms.ServerSessionPool, int)
,TopicConnection.createDurableConnectionConsumer(javax.jms.Topic, java.lang.String, java.lang.String, javax.jms.ServerSessionPool, int)
Method Summary | |
---|---|
void |
close()
Closes the connection consumer. |
ServerSessionPool |
getServerSessionPool()
Gets the server session pool associated with this connection consumer. |
Method Detail |
---|
public ServerSessionPool
getServerSessionPool() throws JMSException
获取与此连接使用方关联的服务器会话池。
return | 此连接使用方使用的服务器会话池 |
Throws | JMSException: 如果 JMS 提供者由于某个内部错误无法获取与此使用方关联的服务器会话池。 |
getServerSessionPool
ServerSessionPool getServerSessionPool() throws JMSException
- Gets the server session pool associated with this connection consumer.
- Returns:
- the server session pool used by this connection consumer
- Throws:
JMSException
- if the JMS provider fails to get the server session pool associated with this consumer due to some internal error.
public void
close() throws JMSException
关闭连接使用方。
由于提供者可能会代表连接使用方分配 Java 虚拟机之外的某些资源,因此不需要这些资源时客户端应该关闭它们。依赖于垃圾收集最终回收这些资源可能不够及时。
Throws | JMSException: 如果 JMS 提供者无法代表连接使用者释放资源,或者无法关闭连接使用方。 |
close
void close() throws JMSException
- Closes the connection consumer.
Since a provider may allocate some resources on behalf of a connection consumer outside the Java virtual machine, clients should close these resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.
- Throws:
JMSException
- if the JMS provider fails to release resources on behalf of the connection consumer or fails to close the connection consumer.
|
|||||||||
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 : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!