View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
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  package net.sf.ehcache.cluster;
17  
18  /***
19   * A listener for cluster topology events
20   *
21   * @author Geert Bevin
22   * @since 2.0
23   */
24  public interface ClusterTopologyListener {
25  
26      /***
27       * A node has joined the cluster
28       *
29       * @param node The joining node
30       */
31      void nodeJoined(ClusterNode node);
32  
33      /***
34       * A node has left the cluster
35       *
36       * @param node The departing node
37       */
38      void nodeLeft(ClusterNode node);
39  
40      /***
41       * This node has established contact with the cluster and can execute clustered operations.
42       *
43       * @param node The current node
44       */
45      void clusterOnline(ClusterNode node);
46  
47      /***
48       * This node has lost contact (possibly temporarily) with the cluster and cannot execute
49       * clustered operations
50       *
51       * @param node The current node
52       */
53      void clusterOffline(ClusterNode node);
54  
55      /***
56       * This node lost contact and rejoined the cluster again.
57       * <p />
58       * This event is only fired in the node which rejoined and not to all the connected nodes
59       * @param oldNode The old node which got disconnected
60       * @param newNode The new node after rejoin
61       */
62      void clusterRejoined(ClusterNode oldNode, ClusterNode newNode);
63  
64  }