KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > ConnectionConsumer


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package javax.jms;
26
27 /** For application servers, <CODE>Connection</CODE> objects provide a special
28   * facility
29   * for creating a <CODE>ConnectionConsumer</CODE> (optional). The messages it
30   * is to consume are
31   * specified by a <CODE>Destination</CODE> and a message selector. In addition,
32   * a <CODE>ConnectionConsumer</CODE> must be given a
33   * <CODE>ServerSessionPool</CODE> to use for
34   * processing its messages.
35   *
36   * <P>Normally, when traffic is light, a <CODE>ConnectionConsumer</CODE> gets a
37   * <CODE>ServerSession</CODE> from its pool, loads it with a single message, and
38   * starts it. As traffic picks up, messages can back up. If this happens,
39   * a <CODE>ConnectionConsumer</CODE> can load each <CODE>ServerSession</CODE>
40   * with more than one
41   * message. This reduces the thread context switches and minimizes resource
42   * use at the expense of some serialization of message processing.
43   *
44   * @version 1.1 February 8, 2002
45   * @author Mark Hapner
46   * @author Rich Burridge
47   *
48   * @see javax.jms.Connection#createConnectionConsumer
49   * @see javax.jms.Connection#createDurableConnectionConsumer
50   * @see javax.jms.QueueConnection#createConnectionConsumer
51   * @see javax.jms.TopicConnection#createConnectionConsumer
52   * @see javax.jms.TopicConnection#createDurableConnectionConsumer
53   */

54
55 public interface ConnectionConsumer {
56
57     /** Gets the server session pool associated with this connection consumer.
58       *
59       * @return the server session pool used by this connection consumer
60       *
61       * @exception JMSException if the JMS provider fails to get the server
62       * session pool associated with this consumer due
63       * to some internal error.
64       */

65
66     ServerSessionPool JavaDoc
67     getServerSessionPool() throws JMSException JavaDoc;
68
69  
70     /** Closes the connection consumer.
71       *
72       * <P>Since a provider may allocate some resources on behalf of a
73       * connection consumer outside the Java virtual machine, clients should
74       * close these resources when
75       * they are not needed. Relying on garbage collection to eventually
76       * reclaim these resources may not be timely enough.
77       *
78       * @exception JMSException if the JMS provider fails to release resources
79       * on behalf of the connection consumer or fails
80       * to close the connection consumer.
81       */

82
83     void
84     close() throws JMSException JavaDoc;
85 }
86
Popular Tags