View Javadoc

1   /**
2    *  Copyright 2003-2006 Greg Luck
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  
17  package net.sf.ehcache.distribution;
18  
19  import net.sf.ehcache.CacheException;
20  import net.sf.ehcache.Cache;
21  
22  import java.util.List;
23  
24  /**
25   * Provides a discovery service to locate {@link CachePeer} RMI listener peers for a Cache.
26   * @author Greg Luck
27   * @version $Id: CacheManagerPeerProvider.java 52 2006-04-24 14:50:03Z gregluck $
28   */
29  public interface CacheManagerPeerProvider {
30  
31      /**
32       * Register a new peer.
33       * @param rmiUrl
34       */
35      void registerPeer(String rmiUrl);
36  
37      /**
38       * Unregisters a peer.
39       *
40       * @param rmiUrl
41       */
42      void unregisterPeer(String rmiUrl);
43  
44      /**
45       * @return a list of {@link CachePeer} peers for the given cache, excluding the local peer.
46       */
47      List listRemoteCachePeers(Cache cache) throws CacheException;
48  
49      /**
50       * Notifies providers to initialise themselves.
51       * @throws CacheException
52       */
53      void init();
54  
55  
56      /**
57       * Providers may be doing all sorts of exotic things and need to be able to clean up on dispose.
58       * @throws CacheException
59       */
60      void dispose() throws CacheException;
61  
62  }