[jboss-cvs] JBossAS SVN: r104447 - trunk/cluster/src/main/java/org/jboss/cache/invalidation/bridges.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue May 4 13:02:26 EDT 2010


Author: bstansberry at jboss.com
Date: 2010-05-04 13:02:26 -0400 (Tue, 04 May 2010)
New Revision: 104447

Modified:
   trunk/cluster/src/main/java/org/jboss/cache/invalidation/bridges/JGCacheInvalidationBridge.java
Log:
Clean up numerous compiler warns

Modified: trunk/cluster/src/main/java/org/jboss/cache/invalidation/bridges/JGCacheInvalidationBridge.java
===================================================================
--- trunk/cluster/src/main/java/org/jboss/cache/invalidation/bridges/JGCacheInvalidationBridge.java	2010-05-04 16:47:22 UTC (rev 104446)
+++ trunk/cluster/src/main/java/org/jboss/cache/invalidation/bridges/JGCacheInvalidationBridge.java	2010-05-04 17:02:26 UTC (rev 104447)
@@ -24,6 +24,7 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.List;
 import java.util.Vector;
 
 import org.jboss.cache.invalidation.BatchInvalidation;
@@ -50,7 +51,7 @@
  * <li> First implementation </li>
  * </ul>
  */
-
+ at SuppressWarnings("deprecation")
 public class JGCacheInvalidationBridge
    extends org.jboss.system.ServiceMBeanSupport
    implements JGCacheInvalidationBridgeMBean,
@@ -60,10 +61,10 @@
 {
    // Constants -----------------------------------------------------
    
-   protected final static Class[] rpc_invalidate_types = new Class[] { String.class, Serializable.class };
-   protected final static Class[] rpc_invalidates_types = new Class[] { String.class, Serializable[].class };
-   protected final static Class[] rpc_invalidate_all_types = new Class[] { String.class };
-   protected final static Class[] rpc_batch_invalidate_types = new Class[] { BatchInvalidation[].class };
+   protected final static Class<?>[] rpc_invalidate_types = new Class[] { String.class, Serializable.class };
+   protected final static Class<?>[] rpc_invalidates_types = new Class[] { String.class, Serializable[].class };
+   protected final static Class<?>[] rpc_invalidate_all_types = new Class[] { String.class };
+   protected final static Class<?>[] rpc_batch_invalidate_types = new Class[] { BatchInvalidation[].class };
 
    // Attributes ----------------------------------------------------      
 
@@ -77,8 +78,8 @@
    protected String RPC_HANDLER_NAME = null;
 
    protected BridgeInvalidationSubscription invalidationSubscription = null;
-   protected Collection localGroups = null;
-   protected Vector bridgedGroups = new Vector();
+   protected Collection<InvalidationGroup> localGroups = null;
+   protected Vector<String> bridgedGroups = new Vector<String>();
 
    // Public --------------------------------------------------------
 
@@ -118,7 +119,7 @@
     * notifications. Need to examine in detail how this method interacts with
     * DistributedState to see if we can remove/narrow the synchronization. 
     */
-   public synchronized void replicantsChanged(String key, java.util.List newReplicants, int newReplicantsViewId,
+   public synchronized void replicantsChanged(String key, List<?> newReplicants, int newReplicantsViewId,
          boolean merge)
    {
       DistributedReplicantManager drm = this.partition.getDistributedReplicantManager();
@@ -131,7 +132,7 @@
          
          // we remove any entry from the DS whose node is dead
          //
-         java.util.Collection coll = ds.getAllKeys(this.RPC_HANDLER_NAME);
+         Collection<?> coll = ds.getAllKeys(this.RPC_HANDLER_NAME);
          if (coll == null)
          {
             this.log.debug("... No bridge info was associated with this node");
@@ -140,8 +141,8 @@
 
          // to avoid ConcurrentModificationException, we copy the list of keys in a new structure
          //
-         ArrayList collCopy = new java.util.ArrayList(coll);
-         java.util.List newReplicantsNodeNames = drm.lookupReplicantsNodeNames(this.RPC_HANDLER_NAME);
+         ArrayList<?> collCopy = new ArrayList<Object>(coll);
+         List<String> newReplicantsNodeNames = drm.lookupReplicantsNodeNames(this.RPC_HANDLER_NAME);
 
          for (int i = 0; i < collCopy.size(); i++)
          {
@@ -185,7 +186,7 @@
 
       // we need to sort which group other nodes accept or refuse and propagate through the net
       //      
-      ArrayList acceptedGroups = new ArrayList();
+      List<BatchInvalidation> acceptedGroups = new ArrayList<BatchInvalidation>();
 
       for (BatchInvalidation currBI : invalidations)
       {
@@ -340,7 +341,7 @@
          this.invalidationSubscription = null;
          this.RPC_HANDLER_NAME = null;
          this.localGroups = null;
-         this.bridgedGroups = new Vector();
+         this.bridgedGroups = new Vector<String>();
       }
       catch (Exception e)
       {
@@ -486,18 +487,19 @@
 
    // Protected -----------------------------------------------------
 
+   @SuppressWarnings("unchecked")
    protected synchronized void publishLocalInvalidationGroups() throws Exception
    {
       this.localGroups = this.invalMgr.getInvalidationGroups();
 
       this.log.debug("Publishing locally available invalidation groups: " + this.localGroups);
 
-      ArrayList content = new ArrayList(this.localGroups);
-      ArrayList result = new ArrayList(content.size());
+      ArrayList<InvalidationGroup> content = new ArrayList<InvalidationGroup>(this.localGroups);
+      ArrayList<String> result = new ArrayList<String>(content.size());
 
       for (int i = 0; i < content.size(); i++)
       {
-         String aGroup = ((InvalidationGroup) content.get(i)).getGroupName();
+         String aGroup = content.get(i).getGroupName();
          result.add(aGroup);
       }
 
@@ -517,7 +519,8 @@
 
    protected void updatedBridgedInvalidationGroupsInfo()
    {
-      Collection bridgedByNode = this.partition.getDistributedStateService().getAllValues(this.RPC_HANDLER_NAME);
+      @SuppressWarnings("unchecked")
+      Collection<NodeInfo> bridgedByNode = (Collection<NodeInfo>) this.partition.getDistributedStateService().getAllValues(this.RPC_HANDLER_NAME);
 
       this.log.debug("Updating list of invalidation groups that are bridged...");
 
@@ -525,25 +528,23 @@
       {
          // Make a copy
          //      
-         ArrayList copy = new ArrayList(bridgedByNode);
+         List<NodeInfo> copy = new ArrayList<NodeInfo>(bridgedByNode);
 
-         Vector result = new Vector();
+         Vector<String> result = new Vector<String>();
 
          String nodeName = this.partition.getNodeName();
          
-         for (int i = 0; i < copy.size(); i++)
+         for (NodeInfo infoForNode : copy)
          {
-            NodeInfo infoForNode = (NodeInfo) copy.get(i);
             this.log.trace("InfoForNode: " + infoForNode);
 
             if (infoForNode != null && !infoForNode.groupName.equals(nodeName))
             {
-               ArrayList groupsForNode = infoForNode.groups;
+               ArrayList<String> groupsForNode = infoForNode.groups;
                this.log.trace("Groups for node: " + groupsForNode);
 
-               for (int j = 0; j < groupsForNode.size(); j++)
+               for (String aGroup : groupsForNode)
                {
-                  String aGroup = (String) groupsForNode.get(j);
                   if (!result.contains(aGroup))
                   {
                      this.log.trace("Adding: " + aGroup);
@@ -582,7 +583,7 @@
 {
    static final long serialVersionUID = -3215712955134929006L;
 
-   public ArrayList groups = null;
+   public ArrayList<String> groups = null;
 
    public String groupName = null;
 
@@ -590,7 +591,7 @@
    {
    }
    
-   public NodeInfo(ArrayList groups, String groupName)
+   public NodeInfo(ArrayList<String> groups, String groupName)
    {
       this.groups = groups;
       this.groupName = groupName;




More information about the jboss-cvs-commits mailing list