[jboss-cvs] JBossCache/src/org/jboss/cache/buddyreplication ...
Manik Surtani
msurtani at jboss.com
Sat Dec 30 14:48:45 EST 2006
User: msurtani
Date: 06/12/30 14:48:45
Modified: src/org/jboss/cache/buddyreplication
GravitateResult.java BuddyGroup.java
BuddyManager.java NextMemberBuddyLocator.java
Log:
Genericised, autoboxed
Revision Changes Path
1.5 +12 -11 JBossCache/src/org/jboss/cache/buddyreplication/GravitateResult.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: GravitateResult.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/GravitateResult.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- GravitateResult.java 29 Nov 2006 18:56:04 -0000 1.4
+++ GravitateResult.java 30 Dec 2006 19:48:45 -0000 1.5
@@ -1,11 +1,11 @@
package org.jboss.cache.buddyreplication;
-import java.util.ArrayList;
-import java.util.List;
-
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
+import java.util.ArrayList;
+import java.util.List;
+
public class GravitateResult
{
private boolean dataFound;
@@ -89,8 +89,9 @@
public List asList()
{
List l = new ArrayList();
- l.add(Boolean.valueOf(dataFound));
- if (dataFound) {
+ l.add(dataFound);
+ if (dataFound)
+ {
if (marshalledData != null)
l.add(marshalledData);
else
1.10 +1 -1 JBossCache/src/org/jboss/cache/buddyreplication/BuddyGroup.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyGroup.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/BuddyGroup.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- BuddyGroup.java 21 Dec 2006 16:19:33 -0000 1.9
+++ BuddyGroup.java 30 Dec 2006 19:48:45 -0000 1.10
@@ -55,7 +55,7 @@
this.dataOwner = dataOwner;
}
- public List getBuddies()
+ public List<Address> getBuddies()
{
return buddies;
}
1.57 +7 -7 JBossCache/src/org/jboss/cache/buddyreplication/BuddyManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/BuddyManager.java,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -b -r1.56 -r1.57
--- BuddyManager.java 30 Dec 2006 17:49:54 -0000 1.56
+++ BuddyManager.java 30 Dec 2006 19:48:45 -0000 1.57
@@ -393,7 +393,7 @@
* @param state Map<Fqn, byte[]> of any state from the DataOwner. Cannot
* be <code>null</code>.
*/
- public void handleAssignToBuddyGroup(BuddyGroup newGroup, Map state) throws Exception
+ public void handleAssignToBuddyGroup(BuddyGroup newGroup, Map<Fqn, byte[]> state) throws Exception
{
if (!initialised) throw new BuddyNotInitException("Not yet initialised");
@@ -515,7 +515,7 @@
// -------------- internal helpers methods --------------------
- private void removeFromGroup(List buddies) throws InterruptedException
+ private void removeFromGroup(List<Address> buddies) throws InterruptedException
{
if (log.isDebugEnabled())
log.debug("Removing obsolete buddies from buddy group [" + buddyGroup.getGroupName() + "]. Obsolete buddies are " + buddies);
@@ -573,8 +573,8 @@
// Create the state transfer map
- Map stateMap = new HashMap();
- byte[] state = null;
+ Map<Fqn, byte[]> stateMap = new HashMap<Fqn, byte[]>();
+ byte[] state;
if (cache.getConfiguration().isUseRegionBasedMarshalling())
{
Collection<Region> regions = cache.getRegionManager().getAllMarshallingRegions();
@@ -733,13 +733,13 @@
}
}
- private void makeRemoteCall(List recipients, MethodCall call) throws Exception
+ private void makeRemoteCall(List<Address> recipients, MethodCall call) throws Exception
{
// remove non-members from dest list
if (recipients != null)
{
- Iterator recipientsIt = recipients.iterator();
- List members = cache.getMembers();
+ Iterator<Address> recipientsIt = recipients.iterator();
+ List<Address> members = cache.getMembers();
while (recipientsIt.hasNext())
{
if (!members.contains(recipientsIt.next()))
1.9 +6 -7 JBossCache/src/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NextMemberBuddyLocator.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- NextMemberBuddyLocator.java 21 Dec 2006 16:19:33 -0000 1.8
+++ NextMemberBuddyLocator.java 30 Dec 2006 19:48:45 -0000 1.9
@@ -128,13 +128,12 @@
return buddies;
}
- private boolean isInSameBuddyPool(Map buddyPoolMap, Object candidate, Object dataOwner)
+ private boolean isInSameBuddyPool(Map<Address, String> buddyPoolMap, Address candidate, Address dataOwner)
{
if (buddyPoolMap == null) return true;
Object ownerPoolName = buddyPoolMap.get(dataOwner);
Object candidatePoolName = buddyPoolMap.get(candidate);
- if (ownerPoolName == null || candidatePoolName == null) return false;
- return ownerPoolName.equals(candidatePoolName);
+ return !(ownerPoolName == null || candidatePoolName == null) && ownerPoolName.equals(candidatePoolName);
}
private boolean isColocated(Address candidate, Address dataOwner)
@@ -148,12 +147,12 @@
// now check other interfaces.
try
{
- for (Enumeration nics = NetworkInterface.getNetworkInterfaces(); nics.hasMoreElements();)
+ for (Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces(); nics.hasMoreElements();)
{
- NetworkInterface i = (NetworkInterface) nics.nextElement();
- for (Enumeration addrs = i.getInetAddresses(); addrs.hasMoreElements();)
+ NetworkInterface i = nics.nextElement();
+ for (Enumeration<InetAddress> addrs = i.getInetAddresses(); addrs.hasMoreElements();)
{
- InetAddress addr = (InetAddress) addrs.nextElement();
+ InetAddress addr = addrs.nextElement();
if (addr.equals(inetC)) return true;
}
}
More information about the jboss-cvs-commits
mailing list