View Javadoc

1   /**
2    *
3    *  Licensed to the Apache Software Foundation (ASF) under one or more
4    *  contributor license agreements.  See the NOTICE file distributed with
5    *  this work for additional information regarding copyright ownership.
6    *  The ASF licenses this file to You under the Apache License, Version 2.0
7    *  (the "License"); you may not use this file except in compliance with
8    *  the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *  Unless required by applicable law or agreed to in writing, software
13   *  distributed under the License is distributed on an "AS IS" BASIS,
14   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   *  See the License for the specific language governing permissions and
16   *  limitations under the License.
17   */
18  package org.apache.geronimo.clustering;
19  
20  
21  /**
22   * Represents a clustered invocation.
23   * <p>
24   * A clustered invocation is intended to be a thin wrapper around an actual invocation enhancing this latter with
25   * an association to a local SessionManager. For instance, an HTTPRequest is an actual invocation.
26   * <p> 
27   * A clustered invocation is interposed between a client and the Session he wants to access to provide cluster wide
28   * access serialization to the requested Session. A clustered invocation is associated to a local SessionManager, even
29   * if no contract captures such a relationship. When a clustered invocation is executed one of the two following 
30   * scenarios happen:
31   * <ul>
32   * <li>the clustered invocation is executed locally. A local execution implies that the local SessionManager associated
33   * to the clustered invocation is owning the Session (may be after a migration); or</li>
34   * <li>the clustered invocation is executed remotely on the Node where the Session is being owned.</li>
35   * </ul>
36   *
37   * @version $Rev$ $Date$
38   */
39  public interface ClusteredInvocation {
40      
41      /**
42       * Invokes the clustered invocation.
43       * 
44       * @throws ClusteredInvocationException Thrown when the invocation cannot be successfully executed. This may
45       * be either due to the fact that the actual invocation has failed or the requestedSessionId is unknown by
46       * the associated local SessionManager and its remote peers.
47       */
48      void invoke() throws ClusteredInvocationException;
49      
50      /**
51       * Gets the sessionId of the Session bound to the invocation represented by this instance.
52       *  
53       * @return sessionId of the targeted Session.
54       */
55      String getRequestedSessionId();
56      
57  }