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

Manik Surtani msurtani at jboss.com
Wed Jan 10 06:32:48 EST 2007


  User: msurtani
  Date: 07/01/10 06:32:48

  Modified:    src/org/jboss/cache/notifications  Notifier.java
  Log:
  optimised UnversionedNode synchronisation, fixed a notification bug and added an optimisation in copying maps in Notifier
  
  Revision  Changes    Path
  1.17      +17 -1     JBossCache/src/org/jboss/cache/notifications/Notifier.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Notifier.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/notifications/Notifier.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- Notifier.java	3 Jan 2007 17:50:31 -0000	1.16
  +++ Notifier.java	10 Jan 2007 11:32:48 -0000	1.17
  @@ -529,7 +529,7 @@
   
      private Map copy(Map<Object, Object> data)
      {
  -      if (data == null) return null;
  +      if (safe(data)) return data;
         return new MapCopy<Object, Object>(data);
      }
   
  @@ -552,6 +552,22 @@
      }
   
      /**
  +    * A map is deemed 'safe' to be passed as-is to a listener, if either of the following are true:
  +    * <ul>
  +    * <li>It is null</li>
  +    * <li>It is an instance of {@link org.jboss.cache.util.MapCopy}, which is immutable</li>
  +    * <li>It is an instance of {@link java.util.Collections#emptyMap()}, which is also immutable</li>
  +    * </ul>
  +    *
  +    * @param map
  +    * @return
  +    */
  +   private boolean safe(Map map)
  +   {
  +      return map == null || map instanceof MapCopy || map.getClass().equals(Collections.emptyMap().getClass());
  +   }
  +
  +   /**
       * Fires off all notifications for a given queue.
       *
       * @param queue queue to process.
  
  
  



More information about the jboss-cvs-commits mailing list