📄 connection.java
字号:
* object describing the problem. * * <P>An exception listener allows a client to be notified of a problem * asynchronously. * Some connections only consume messages, so they would have no other * way to learn their connection has failed. * * <P>A connection serializes execution of its * <CODE>ExceptionListener</CODE>. * * <P>A JMS provider should attempt to resolve connection problems * itself before it notifies the client of them. * * @param listener the exception listener * * @exception JMSException if the JMS provider fails to * set the exception listener for this connection. * */ void setExceptionListener(ExceptionListener listener) throws JMSException; /** Starts (or restarts) a connection's delivery of incoming messages. * A call to <CODE>start</CODE> on a connection that has already been * started is ignored. * * @exception JMSException if the JMS provider fails to start * message delivery due to some internal error. * * @see javax.jms.Connection#stop */ void start() throws JMSException; /** Temporarily stops a connection's delivery of incoming messages. * Delivery can be restarted using the connection's <CODE>start</CODE> * method. When the connection is stopped, * delivery to all the connection's message consumers is inhibited: * synchronous receives block, and messages are not delivered to message * listeners. * * <P>This call blocks until receives and/or message listeners in progress * have completed. * * <P>Stopping a connection has no effect on its ability to send messages. * A call to <CODE>stop</CODE> on a connection that has already been * stopped is ignored. * * <P>A call to <CODE>stop</CODE> must not return until delivery of messages * has paused. This means that a client can rely on the fact that none of * its message listeners will be called and that all threads of control * waiting for <CODE>receive</CODE> calls to return will not return with a * message until the * connection is restarted. The receive timers for a stopped connection * continue to advance, so receives may time out while the connection is * stopped. * * <P>If message listeners are running when <CODE>stop</CODE> is invoked, * the <CODE>stop</CODE> call must * wait until all of them have returned before it may return. While these * message listeners are completing, they must have the full services of the * connection available to them. * * @exception JMSException if the JMS provider fails to stop * message delivery due to some internal error. * * @see javax.jms.Connection#start */ void stop() throws JMSException; /** Closes the connection. * * <P>Since a provider typically allocates significant resources outside * the JVM on behalf of a connection, clients should close these resources * when they are not needed. Relying on garbage collection to eventually * reclaim these resources may not be timely enough. * * <P>There is no need to close the sessions, producers, and consumers * of a closed connection. * * <P>Closing a connection causes all temporary destinations to be * deleted. * * <P>When this method is invoked, it should not return until message * processing has been shut down in an orderly fashion. This means that all * message * listeners that may have been running have returned, and that all pending * receives have returned. A close terminates all pending message receives * on the connection's sessions' consumers. The receives may return with a * message or with null, depending on whether there was a message available * at the time of the close. If one or more of the connection's sessions' * message listeners is processing a message at the time when connection * <CODE>close</CODE> is invoked, all the facilities of the connection and * its sessions must remain available to those listeners until they return * control to the JMS provider. * * <P>Closing a connection causes any of its sessions' transactions * in progress to be rolled back. In the case where a session's * work is coordinated by an external transaction manager, a session's * <CODE>commit</CODE> and <CODE>rollback</CODE> methods are * not used and the result of a closed session's work is determined * later by the transaction manager. * * Closing a connection does NOT force an * acknowledgment of client-acknowledged sessions. * * <P>Invoking the <CODE>acknowledge</CODE> method of a received message * from a closed connection's session must throw an * <CODE>IllegalStateException</CODE>. Closing a closed connection must * NOT throw an exception. * * @exception JMSException if the JMS provider fails to close the * connection due to some internal error. For * example, a failure to release resources * or to close a socket connection can cause * this exception to be thrown. * */ void close() throws JMSException; /** Creates a connection consumer for this connection (optional operation). * This is an expert facility not used by regular JMS clients. * * @param destination the destination to access * @param messageSelector only messages with properties matching the * message selector expression are delivered. A value of null or * an empty string indicates that there is no message selector * for the message consumer. * @param sessionPool the server session pool to associate with this * connection consumer * @param maxMessages the maximum number of messages that can be * assigned to a server session at one time * * @return the connection consumer * * @exception JMSException if the <CODE>Connection</CODE> object fails * to create a connection consumer due to some * internal error or invalid arguments for * <CODE>sessionPool</CODE> and * <CODE>messageSelector</CODE>. * @exception InvalidDestinationException if an invalid destination is specified. * @exception InvalidSelectorException if the message selector is invalid. * * @since 1.1 * @see javax.jms.ConnectionConsumer */ ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException; /** Create a durable connection consumer for this connection (optional operation). * This is an expert facility not used by regular JMS clients. * * @param topic topic to access * @param subscriptionName durable subscription name * @param messageSelector only messages with properties matching the * message selector expression are delivered. A value of null or * an empty string indicates that there is no message selector * for the message consumer. * @param sessionPool the server session pool to associate with this * durable connection consumer * @param maxMessages the maximum number of messages that can be * assigned to a server session at one time * * @return the durable connection consumer * * @exception JMSException if the <CODE>Connection</CODE> object fails * to create a connection consumer due to some * internal error or invalid arguments for * <CODE>sessionPool</CODE> and * <CODE>messageSelector</CODE>. * @exception InvalidDestinationException if an invalid destination * is specified. * @exception InvalidSelectorException if the message selector is invalid. * @since 1.1 * @see javax.jms.ConnectionConsumer */ ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -