01: /*
02: * @(#)ConnectionConsumer.java 1.16 02/04/09
03: *
04: * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * SUN PROPRIETARY/CONFIDENTIAL.
07: * This software is the proprietary information of Sun Microsystems, Inc.
08: * Use is subject to license terms.
09: *
10: */
11:
12: package javax.jms;
13:
14: /** For application servers, <CODE>Connection</CODE> objects provide a special
15: * facility
16: * for creating a <CODE>ConnectionConsumer</CODE> (optional). The messages it
17: * is to consume are
18: * specified by a <CODE>Destination</CODE> and a message selector. In addition,
19: * a <CODE>ConnectionConsumer</CODE> must be given a
20: * <CODE>ServerSessionPool</CODE> to use for
21: * processing its messages.
22: *
23: * <P>Normally, when traffic is light, a <CODE>ConnectionConsumer</CODE> gets a
24: * <CODE>ServerSession</CODE> from its pool, loads it with a single message, and
25: * starts it. As traffic picks up, messages can back up. If this happens,
26: * a <CODE>ConnectionConsumer</CODE> can load each <CODE>ServerSession</CODE>
27: * with more than one
28: * message. This reduces the thread context switches and minimizes resource
29: * use at the expense of some serialization of message processing.
30: *
31: * @version 1.1 February 8, 2002
32: * @author Mark Hapner
33: * @author Rich Burridge
34: *
35: * @see javax.jms.Connection#createConnectionConsumer
36: * @see javax.jms.Connection#createDurableConnectionConsumer
37: * @see javax.jms.QueueConnection#createConnectionConsumer
38: * @see javax.jms.TopicConnection#createConnectionConsumer
39: * @see javax.jms.TopicConnection#createDurableConnectionConsumer
40: */
41:
42: public interface ConnectionConsumer {
43:
44: /** Gets the server session pool associated with this connection consumer.
45: *
46: * @return the server session pool used by this connection consumer
47: *
48: * @exception JMSException if the JMS provider fails to get the server
49: * session pool associated with this consumer due
50: * to some internal error.
51: */
52:
53: ServerSessionPool getServerSessionPool() throws JMSException;
54:
55: /** Closes the connection consumer.
56: *
57: * <P>Since a provider may allocate some resources on behalf of a
58: * connection consumer outside the Java virtual machine, clients should
59: * close these resources when
60: * they are not needed. Relying on garbage collection to eventually
61: * reclaim these resources may not be timely enough.
62: *
63: * @exception JMSException if the JMS provider fails to release resources
64: * on behalf of the connection consumer or fails
65: * to close the connection consumer.
66: */
67:
68: void close() throws JMSException;
69: }
|