axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/ime/internal/util KeyedBuffer.java NonPersistentKeyedBuffer.java
Date Tue, 19 Nov 2002 20:42:26 GMT
jmsnell     2002/11/19 12:42:26

  Modified:    java/src/org/apache/axis/ime/internal/util KeyedBuffer.java
                        NonPersistentKeyedBuffer.java
  Log:
  
  
  Revision  Changes    Path
  1.2       +5 -0      xml-axis/java/src/org/apache/axis/ime/internal/util/KeyedBuffer.java
  
  Index: KeyedBuffer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/KeyedBuffer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- KeyedBuffer.java	29 Oct 2002 05:15:30 -0000	1.1
  +++ KeyedBuffer.java	19 Nov 2002 20:42:26 -0000	1.2
  @@ -83,6 +83,11 @@
       public Object peek();
   
       /**
  +     * Select, but do not remove all messages on the 
  +     * channel.  This method will not block.
     */
  +    public Object[] peekAll();
  +
  +    /**
        * Put a message onto the channel
        */
       public void put(
  
  
  
  1.3       +50 -0     xml-axis/java/src/org/apache/axis/ime/internal/util/NonPersistentKeyedBuffer.java
  
  Index: NonPersistentKeyedBuffer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/ime/internal/util/NonPersistentKeyedBuffer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NonPersistentKeyedBuffer.java	29 Oct 2002 23:33:40 -0000	1.2
  +++ NonPersistentKeyedBuffer.java	19 Nov 2002 20:42:26 -0000	1.3
  @@ -60,6 +60,7 @@
   import org.apache.commons.logging.Log;
   
   import java.util.Vector;
  +import java.util.Iterator;
   
   /**
    * Creates a non-persistent KeyedBuffer.  Queued messages
  @@ -95,6 +96,28 @@
           }
       }
   
  +
  +    public Object[] peekAll() {
  +        if (log.isDebugEnabled()) {
  +            log.debug("Enter: KeyedBuffer::selectAll");
  +        }
  +        Vector v = new Vector();
  +        KeyedNode node = null;
  +        synchronized (messages) {
  +            for (Iterator i = messages.iterator(); i.hasNext();) {
  +              v.add(i.next());
  +            }
  +        }
  +        Object[] objects = new
  +                Object[v.size()];
  +        v.copyInto(objects);
  +        if (log.isDebugEnabled()) {
  +            log.debug("Exit: KeyedBuffer::selectAll");
  +        }
  +        return objects;
  +    }
  +
  +
       public void put(
               Object key,
               Object object) {
  @@ -367,6 +390,33 @@
               return node;
           }
   
  +        protected Iterator iterator() {
  +          return new KeyedQueueIterator(head);
  +        }
       }
   
  +    protected static class KeyedQueueIterator
  +      implements Iterator {
  +        protected KeyedNode current;
  +        protected KeyedNode next;
  +        public KeyedQueueIterator(KeyedNode node) {
  +          this.next = node;
  +        }
  +        
  +        public boolean hasNext() {
  +          return (next != null);
  +        }
  +
  +        public Object next() {
  +          KeyedNode node = null;
  +          if (next != null) {
  +            node = next.next;
  +          }
  +          current = next;
  +          next = node;
  +          return current;
  +        }
  +
  +        public void remove() {}
  +    }
   }
  
  
  

Mime
View raw message