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

Manik Surtani manik at jboss.org
Sun Mar 18 19:17:12 EDT 2007


  User: msurtani
  Date: 07/03/18 19:17:12

  Modified:    src/org/jboss/cache/buddyreplication  BuddyManager.java
  Log:
  drain the view change queue before adding new view change.
  
  Revision  Changes    Path
  1.72      +74 -0     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.71
  retrieving revision 1.72
  diff -u -b -r1.71 -r1.72
  --- BuddyManager.java	17 Mar 2007 19:11:03 -0000	1.71
  +++ BuddyManager.java	18 Mar 2007 23:17:12 -0000	1.72
  @@ -55,6 +55,10 @@
      private static Log log = LogFactory.getLog(BuddyManager.class);
   
      /**
  +    * A place to drain the view change queue.
  +    */
  +   private Collection<MembershipChange> sink = new NullCollection<MembershipChange>();
  +   /**
       * Configuration object.
       */
      final BuddyReplicationConfig config;
  @@ -270,6 +274,8 @@
         // put this on a queue
         try
         {
  +         //first empty the queue.  All queued up view changes that have not been processed yet are now obsolete.
  +         queue.drainTo(sink);
            queue.put(new MembershipChange(oldMembers, newMembers));
         }
         catch (InterruptedException e)
  @@ -1011,4 +1017,72 @@
            return infoReceived;
         }
      }
  +
  +   private class NullCollection<E> implements Collection<E>
  +   {
  +
  +      public int size()
  +      {
  +         return 0;  //Does nothing
  +      }
  +
  +      public boolean isEmpty()
  +      {
  +         return true;
  +      }
  +
  +      public boolean contains(Object o)
  +      {
  +         return false;
  +      }
  +
  +      public Iterator<E> iterator()
  +      {
  +         return null;
  +      }
  +
  +      public Object[] toArray()
  +      {
  +         return new Object[0];
  +      }
  +
  +      public <T> T[] toArray(T[] a)
  +      {
  +         return null;
  +      }
  +
  +      public boolean add(E o)
  +      {
  +         return true;
  +      }
  +
  +      public boolean remove(Object o)
  +      {
  +         return true;
  +      }
  +
  +      public boolean containsAll(Collection<?> c)
  +      {
  +         return false;
  +      }
  +
  +      public boolean addAll(Collection<? extends E> c)
  +      {
  +         return true;
  +      }
  +
  +      public boolean removeAll(Collection<?> c)
  +      {
  +         return true;
  +      }
  +
  +      public boolean retainAll(Collection<?> c)
  +      {
  +         return true;
  +      }
  +
  +      public void clear()
  +      {
  +      }
  +   }
   }
  \ No newline at end of file
  
  
  



More information about the jboss-cvs-commits mailing list