QueueBrowser (Java EE 5)

Java EE API


javax.jms Interface QueueBrowser


public interface QueueBrowser


客户端使用 QueueBrowser 对象查看队列中的消息,而不会移除它们。

getEnumeration 方法返回用于扫描队列消息的 java.util.Enumeration。它可能是整个队列内容的枚举,也可能只包含与消息选择器相匹配的消息。

消息可能在扫描完成时到达和过期。JMS API 不要求枚举的内容为队列内容的静态快照。这些更改是否可见取决于 JMS 提供者。

可以从 SessionQueueSession 创建 QueueBrowser

英文文档:

A client uses a QueueBrowser object to look at messages on a queue without removing them.

The getEnumeration method returns a java.util.Enumeration that is used to scan the queue's messages. It may be an enumeration of the entire content of a queue, or it may contain only the messages matching a message selector.

Messages may be arriving and expiring while the scan is done. The JMS API does not require the content of an enumeration to be a static snapshot of queue content. Whether these changes are visible or not depends on the JMS provider.

A QueueBrowser can be created from either a Session or a QueueSession.

Version:
1.1 April 9, 2002
Author:
Mark Hapner, Rich Burridge, Kate Stout
See Also:
Session.createBrowser(javax.jms.Queue), QueueSession.createBrowser(javax.jms.Queue), QueueReceiver

Method Summary
 void
 Enumeration
 String
 Queue
 

Method Detail

public Queue getQueue() throws JMSException
获取与此队列浏览器关联的队列。
return 队列
ThrowsJMSException: 如果 JMS 提供者由于某个内部错误无法获取与此浏览器关联的队列。
英文文档:

getQueue

Queue getQueue()
               throws JMSException
Gets the queue associated with this queue browser.

Returns:
the queue
Throws:
JMSException - if the JMS provider fails to get the queue associated with this browser due to some internal error.

public String getMessageSelector() throws JMSException
获取此队列浏览器的消息选择器表达式。
return 此队列浏览器的消息选择器;如果该消息使用方没有消息选择器(即如果消息选择器未设置或设置为 null 或空字符串),则返回 null
ThrowsJMSException: 如果 JMS 提供者由于某个内部错误无法获取此浏览器的消息选择器。
英文文档:

getMessageSelector

String getMessageSelector()
                          throws JMSException
Gets this queue browser's message selector expression.

Returns:
this queue browser's message selector, or null if no message selector exists for the message consumer (that is, if the message selector was not set or was set to null or the empty string)
Throws:
JMSException - if the JMS provider fails to get the message selector for this browser due to some internal error.

public java.util.Enumeration<E> getEnumeration() throws JMSException
获取按照它们将被接收的顺序浏览当前队列消息的枚举。
return 浏览这些消息的枚举
ThrowsJMSException: 如果 JMS 提供者由于某个内部错误无法获取此浏览器的枚举。
英文文档:

getEnumeration

Enumeration getEnumeration()
                           throws JMSException
Gets an enumeration for browsing the current queue messages in the order they would be received.

Returns:
an enumeration for browsing the messages
Throws:
JMSException - if the JMS provider fails to get the enumeration for this browser due to some internal error.

public void close() throws JMSException
关闭 QueueBrowser

由于提供者可能会代表 QueueBrowser 分配 Java 虚拟机之外的某些资源,因此不需要这些资源时客户端应该关闭它们。依赖于垃圾收集最终回收这些资源可能不够及时。

ThrowsJMSException: 如果 JMS 提供者由于某个内部错误无法关闭此浏览器。

英文文档:

close

void close()
           throws JMSException
Closes the QueueBrowser.

Since a provider may allocate some resources on behalf of a QueueBrowser outside the Java virtual machine, clients should close them 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 close this browser due to some internal error.


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!