01: /*
02: * Copyright 2002-2005 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.jms.listener.serversession;
18:
19: import javax.jms.JMSException;
20: import javax.jms.ServerSession;
21:
22: import org.springframework.jms.listener.serversession.ListenerSessionManager;
23:
24: /**
25: * SPI interface to be implemented by components that manage
26: * JMS ServerSessions. Usually, but not necessarily, an implementation
27: * of this interface will hold a pool of ServerSessions.
28: *
29: * <p>The passed-in ListenerSessionManager has to be used for creating
30: * and executing JMS Sessions. This session manager is responsible for
31: * registering a MessageListener with all Sessions that it creates.
32: * Consequently, the ServerSessionFactory implementation has to
33: * concentrate on the actual lifecycle (e.g. pooling) of JMS Sessions,
34: * but is not concerned about Session creation or execution.
35: *
36: * @author Juergen Hoeller
37: * @since 2.0
38: * @see org.springframework.jms.listener.serversession.ListenerSessionManager
39: * @see org.springframework.jms.listener.serversession.ServerSessionMessageListenerContainer
40: */
41: public interface ServerSessionFactory {
42:
43: /**
44: * Retrieve a JMS ServerSession for the given session manager.
45: * @param sessionManager the session manager to use for
46: * creating and executing new listener sessions
47: * (implicitly indicating the target listener to invoke)
48: * @return the JMS ServerSession
49: * @throws JMSException if retrieval failed
50: */
51: ServerSession getServerSession(ListenerSessionManager sessionManager)
52: throws JMSException;
53:
54: /**
55: * Close all ServerSessions for the given session manager.
56: * @param sessionManager the session manager used for
57: * creating and executing new listener sessions
58: * (implicitly indicating the target listener)
59: */
60: void close(ListenerSessionManager sessionManager);
61:
62: }
|