01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.clustering;
17:
18: import java.util.Set;
19:
20: /**
21: * Represents a local SessionManager.
22: * <p>
23: * A local SessionManager works collaboratively with remote SessionManagers to manage Session instances. A local
24: * SessionMananger along with its associated remote SessionManagers are a single space where Session instances live.
25: * In this space, each Session is ensured to have a unique sessionId. This contract is enforced during creation of
26: * a Session instance by a local SessionManager. A Session in this space is preemptively migrated from one local
27: * SessionManager to another. The interposition of a ClusteredInvocation between a Client and the Session he wants to
28: * access ensures that at any point in time a Session is uniquely instantiated once cluster wide. Clients can
29: * receive migration callbacks via the registration of SessionListener.
30: *
31: * @version $Rev$ $Date$
32: */
33: public interface SessionManager {
34:
35: /**
36: * Creates a Session having the specified sessionId.
37: *
38: * @param sessionId Unique identifier of the Session instance.
39: * @return Session instance.
40: * @throws SessionAlreadyExistException Thrown when the provided sessiondId already exists in the Session space
41: * of this local SessionManager and its associated remote SessionManagers.
42: */
43: Session createSession(String sessionId)
44: throws SessionAlreadyExistException;
45:
46: /**
47: * Registers a migration listener.
48: */
49: void registerListener(SessionListener listener);
50:
51: /**
52: * Unregisters a migration listener.
53: */
54: void unregisterListener(SessionListener listener);
55:
56: /**
57: * Gets the Cluster this local SessionManager is associated to.
58: *
59: * @return Associated Cluster.
60: */
61: Cluster getCluster();
62:
63: /**
64: * Gets the Node hosting this local SessionManager.
65: *
66: * @return Hosting Node.
67: */
68: Node getNode();
69:
70: /**
71: * Gets the remote Nodes hosting the corresponding remote SessionManagers.
72: *
73: * @return Hosting Node.
74: */
75: Set<Node> getRemoteNodes();
76:
77: void registerSessionManagerListener(SessionManagerListener listener);
78:
79: void unregisterSessionManagerListener(
80: SessionManagerListener listener);
81: }
|