[jboss-cvs] JBossCache/src/org/jboss/cache/interceptors ...

Elias Ross genman at noderunner.net
Tue Apr 17 02:09:13 EDT 2007


  User: genman  
  Date: 07/04/17 02:09:13

  Modified:    src/org/jboss/cache/interceptors 
                        OptimisticNodeInterceptor.java
  Log:
  JBCACHE-1005 - Clean up warnings generated from genericising of interface
  Use Collections.singletonMap() for cases only a single key/value is used
  
  Revision  Changes    Path
  1.62      +3 -4      JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: OptimisticNodeInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/interceptors/OptimisticNodeInterceptor.java,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -b -r1.61 -r1.62
  --- OptimisticNodeInterceptor.java	2 Apr 2007 23:28:22 -0000	1.61
  +++ OptimisticNodeInterceptor.java	17 Apr 2007 06:09:13 -0000	1.62
  @@ -24,6 +24,7 @@
   import org.jboss.cache.optimistic.WorkspaceNode;
   import org.jboss.cache.transaction.GlobalTransaction;
   
  +import java.util.Collections;
   import java.util.HashMap;
   import java.util.Map;
   import java.util.SortedMap;
  @@ -294,8 +295,7 @@
         if (workspaceNode == null)
            throw new NodeNotExistsException("optimisticCreateIfNotExistsInterceptor should have created this node!");
   
  -      Map addedData = new HashMap();
  -      addedData.put(key, value);
  +      Map addedData = Collections.singletonMap(key, value);
         // pre-notify
         notifier.notifyNodeModified(workspaceNode.getFqn(), true, CacheListener.ModificationType.PUT_DATA, workspaceNode.getData(), false);
   
  @@ -354,8 +354,7 @@
         Object old = workspaceNode.remove(removeKey);
         workspace.addNode(workspaceNode);
   
  -      Map removedData = new HashMap();
  -      removedData.put(removeKey, old);
  +      Map removedData = Collections.singletonMap(removeKey, old);
         // post-notify
         notifier.notifyNodeModified(workspaceNode.getFqn(), false, CacheListener.ModificationType.REMOVE_DATA, removedData, false);
   
  
  
  



More information about the jboss-cvs-commits mailing list