|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
BuddyLocator.java | - | - | - | - |
|
1 | /* | |
2 | * JBoss, Home of Professional Open Source | |
3 | * | |
4 | * Distributable under LGPL license. | |
5 | * See terms of license at gnu.org. | |
6 | */ | |
7 | package org.jboss.cache.buddyreplication; | |
8 | ||
9 | import org.jboss.cache.config.BuddyReplicationConfig; | |
10 | import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig; | |
11 | import org.jgroups.Address; | |
12 | ||
13 | import java.util.List; | |
14 | import java.util.Map; | |
15 | ||
16 | /** | |
17 | * Buddy Locators help the {@link org.jboss.cache.buddyreplication.BuddyManager} select buddies for its buddy group. | |
18 | * <p/> | |
19 | * Implementations of this class must declare a public no-arguments constructor. | |
20 | * </p> | |
21 | * | |
22 | * @author <a href="mailto:manik@jboss.org">Manik Surtani (manik@jboss.org)</a> | |
23 | * @since 1.4.0 | |
24 | */ | |
25 | public interface BuddyLocator | |
26 | { | |
27 | /** | |
28 | * Gets the configuration for this BuddyLocator. | |
29 | * | |
30 | * @return object encapsulating this object's configuration. | |
31 | * Should not return <code>null</code>. If {@link #init(org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig)} | |
32 | * has not been called or <code>null</code> was passed to it, the | |
33 | * returned value should be the default config for the | |
34 | * given BuddyLocator implementation. | |
35 | */ | |
36 | public BuddyLocatorConfig getConfig(); | |
37 | ||
38 | /** | |
39 | * Initialize this <code>BuddyLocator</code>. | |
40 | * | |
41 | * @param config configuration for this <code>BuddyLocator</code>. May be | |
42 | * <code>null</code>, in which case the implementation should | |
43 | * use its default configuration. | |
44 | */ | |
45 | public void init(BuddyReplicationConfig.BuddyLocatorConfig config); | |
46 | ||
47 | /** | |
48 | * Choose a set of buddies for the given node. Invoked when a change in | |
49 | * cluster membership is detected. | |
50 | * | |
51 | * @param buddyPoolMap Map<Address, String> mapping nodes in the cluster to | |
52 | * the "buddy pool" they have identified themselves as | |
53 | * belonging too. A BuddyLocator implementation can use | |
54 | * this information to preferentially assign buddies from | |
55 | * the same buddy pool as <code>dataOwner</code>. May be | |
56 | * <code>null</code> if buddy pools aren't configured. | |
57 | * @param currentMembership List<Address> of the current cluster members | |
58 | * @param dataOwner Address of the node for which buddies should be selected | |
59 | * @return List<Address> of the nodes that should serve as buddies for | |
60 | * <code>dataOwner</code>. Will not be <code>null</code>, may | |
61 | * be empty. | |
62 | */ | |
63 | public List<Address> locateBuddies(Map<Address, String> buddyPoolMap, List<Address> currentMembership, Address dataOwner); | |
64 | } |
|