[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility ...

Ron Sigal ron_sigal at yahoo.com
Wed Jul 19 19:22:52 EDT 2006


  User: rsigal  
  Date: 06/07/19 19:22:52

  Modified:    src/main/org/jboss/remoting/transport/multiplex/utility      
                        VirtualSelector.java AddressPair.java
                        StoppableThread.java GrowablePipedInputStream.java
                        ShrinkableByteArrayOutputStream.java
                        GrowablePipedOutputStream.java
  Log:
  JBREM-390:  added javadoc.
  
  Revision  Changes    Path
  1.3       +23 -17    JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/VirtualSelector.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: VirtualSelector.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/VirtualSelector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- VirtualSelector.java	20 May 2006 04:57:05 -0000	1.2
  +++ VirtualSelector.java	19 Jul 2006 23:22:52 -0000	1.3
  @@ -42,8 +42,9 @@
    */
   
   /**
  - * VirtualSelector is a simple version of java.nio.channels.Selector.  It allows a thread to 
  - * listen for InputStreams to notify it that they have bytes ready to reaad.
  + * <code>VirtualSelector</code> is a simple version of
  + * <code>java.nio.channels.Selector</code>.  It allows a thread to 
  + * register for <code>InputStream</code>s to notify it that they have bytes ready to read.
    */
   public class VirtualSelector
   {  
  @@ -59,7 +60,7 @@
      
      
   /**
  - * Allows an InputStream to register itself and an attachment.
  + * Allows an <code>InputStream</code> to register itself and an attachment.
    * @param inputStream
    * @param attachment
    */
  @@ -70,7 +71,7 @@
      
      
   /**
  - * Allows an InputStream to unregister itself.
  + * Allows an <code>InputStream</code> to unregister itself.
    * @param inputStream
    */
      public synchronized void unregister(InputStream inputStream)
  @@ -82,10 +83,11 @@
      
      
   /**
  - * Allows a Thread to wait to be informed of InputStreams that have bytes ready to read.
  - * @return a Map from a set of InputStreams with ready bytes to their attachments.
  - *         If close() is called while a Thread is waiting in select(), and if there are
  - *         no ready InputStreams, select() will return null.
  + * Allows a <code>Thread</code> to wait to be informed of InputStreams that have bytes ready to read.
  + * @return a <code>Map</code> from a set of <code>InputStream</code>s with ready bytes to their attachments.
  + *         If <code>close()</code> is called while a <code>Thread</code> is waiting in
  + *         <code>select()</code>, and if there are
  + *         no ready <code>InputStreams</code>, <code>select()</code> will return null.
    */
      public synchronized Map select()
      {
  @@ -139,8 +141,8 @@
      
      
   /**
  - * Returns true if and only if this VirtualSelector is open.
  - * @return true if and only if this VirtualSelector is open
  + * Returns true if and only if this <code>VirtualSelector</code> is open.
  + * @return true if and only if this <code>VirtualSelector</code> is open
    */
      public boolean isOpen()
      {
  @@ -149,8 +151,8 @@
      
      
   /**
  - * Marks this VirtualSelector as preparing to close.
  - * If any Thread is blocked in select(), select() returns null.
  + * Marks this <code>VirtualSelector</code> as preparing to close.
  + * If any <code>Thread</code> is blocked in <code>select()</code>, <code>select()</code> returns null.
    */
      public synchronized void close()
      {
  @@ -164,7 +166,8 @@
      
      
   /**
  - * Allows an InputStream to inform a listening Thread that it has bytes ready to read.
  + * Allows an <code>InputStream</code> to inform a listening <code>Thread</code>
  + * that it has bytes ready to read.
    * @param inputStream
    */
      public synchronized void addToReadyInputStreams(InputStream inputStream)
  @@ -179,9 +182,12 @@
      
      
   /**
  - * Indicates that an InputStream has been processed.  If InputStream has no available bytes, it
  - * will be removed from the Set of InputStreams that will be returned by the next call to
  - * select().  If InputStream has available bytes, its status will not be changed.
  + * Indicates that an <code>InputStream</code> has been processed.
  + * If <code>InputStream</code> has no available bytes, it
  + * will be removed from the <code>Set</code> of <code>InputStream</code>s
  + * that will be returned by the next call to
  + * <code>select()</code>.  If <code>InputStream</code> has available bytes,
  + * its status will not be changed.
    * 
    * @param inputStream
    * @throws IOException
  @@ -208,7 +214,7 @@
      
      
   /**
  - * Finishes the process of closing this VirtualSelector, releasing all resources.
  + * Finishes the process of closing this <code>VirtualSelector</code>, releasing all resources.
    */
      protected void finishClose()
      {
  
  
  
  1.4       +5 -4      JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/AddressPair.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AddressPair.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/AddressPair.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- AddressPair.java	3 Jan 2006 00:34:58 -0000	1.3
  +++ AddressPair.java	19 Jul 2006 23:22:52 -0000	1.4
  @@ -31,10 +31,11 @@
   
   
   /**
  - * A AddressPair.
  -
  + * <code>AddressPair</code> is a utility class that represents a pair of socket addresses,
  + * each with a host and port.
  + *
    * @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    * <p>
    * Copyright (c) 2005
    * </p>
  @@ -52,7 +53,7 @@
      
   /**
    * 
  - * Create a new AddressPair.
  + * Create a new <code>AddressPair</code>.
    * @param remoteHost
    * @param remotePort
    * @param localHost
  
  
  
  1.4       +2 -1      JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/StoppableThread.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: StoppableThread.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/StoppableThread.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- StoppableThread.java	3 Jan 2006 00:34:58 -0000	1.3
  +++ StoppableThread.java	19 Jul 2006 23:22:52 -0000	1.4
  @@ -28,7 +28,8 @@
   
   
   /**
  - * 
  + * <code>StoppableThread</code> is the abstract parent of several threads used in the Multiplex system.
  + * It is distinguished by a <code>shutdown()</code> method that facilitates termination. 
    * <p>
    * Copyright (c) 2005
    * <p>
  
  
  
  1.9       +20 -8     JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/GrowablePipedInputStream.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: GrowablePipedInputStream.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/GrowablePipedInputStream.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- GrowablePipedInputStream.java	7 May 2006 22:26:16 -0000	1.8
  +++ GrowablePipedInputStream.java	19 Jul 2006 23:22:52 -0000	1.9
  @@ -35,10 +35,22 @@
   
   
   /**
  - * A GrowablePipedInputStream.
  -
  + * <code>GrowablePipedInputStream</code> is the parent of the
  + * <code>MultiplexingInputStream</code> returned by
  + * <code>VirtualSocket.getInputStream()</code>.  <code>GrowablePipedInputStream</code> and
  + * <code>GrowablePipedOutputStream</code> work together like <code>java.io.PipedInputStream</code>
  + * and <code>java.io.PipedOutputStream</code>, so that
  + * calling <code>GrowablePipedOutputStream.write()</code> causes bytes to be deposited with the
  + * matching <code>GrowablePipedInputStream</code>.  However, unlike <code>PipedInputStream</code>,
  + * <code>GrowablePipedInputStream</code> stores bytes in a 
  + * <code>ShrinkableByteArrayOutputStream</code>, which
  + * can grow and contract dynamically in response to the number of bytes it contains.
  + *
  + * <p>
  + * For more information about method behavior, see the <code>java.io.InputStream</code> javadoc.
  + * <p>
    * @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
  - * @version $Revision: 1.8 $
  + * @version $Revision: 1.9 $
    * <p>
    * Copyright (c) 2005
    * </p>
  @@ -55,14 +67,14 @@
   
      
   /**
  -    * Create a new GrowablePipedInputStream.
  +    * Create a new <code>GrowablePipedInputStream</code>.
       */
      public GrowablePipedInputStream()
      {
      }
      
   /**
  - * Create a new GrowablePipedInputStream.
  + * Create a new <code>GrowablePipedInputStream</code>.
    * @param virtualSelector 
    */
      public GrowablePipedInputStream(VirtualSelector virtualSelector)
  @@ -72,7 +84,7 @@
   
   
   /**
  - * Create a new GrowablePipedInputStream.
  + * Create a new <code>GrowablePipedInputStream</code>.
    * @param src
    * 
    * @throws java.io.IOException
  @@ -86,8 +98,8 @@
      
         
   /**
  - * Create a new GrowablePipedInputStream.
  - * @param virtualSelector TODO
  + * Create a new <code>GrowablePipedInputStream</code>.
  + * @param virtualSelector 
    * @param src
    * 
    * @throws java.io.IOException
  
  
  
  1.5       +31 -22    JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/ShrinkableByteArrayOutputStream.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ShrinkableByteArrayOutputStream.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/ShrinkableByteArrayOutputStream.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- ShrinkableByteArrayOutputStream.java	2 May 2006 05:18:46 -0000	1.4
  +++ ShrinkableByteArrayOutputStream.java	19 Jul 2006 23:22:52 -0000	1.5
  @@ -31,10 +31,27 @@
   
   
   /**
  - * A ShrinkableByteArrayOutputStream.
  -
  + * ShrinkableByteArrayOutputStream extends java.io.ByteArrayOutputStream and adds
  + * the following features:
  + * <p>
  + * <ol>
  + *  <li>Rather than creating a new byte array with each call to <code>toByteArray()</code>,
  + *   it returns a reference to its internal byte array.  <code>start()</code>
  + *   returns the position of the next available byte and <code>available()</code>
  + *   returns the number of bytes of content, starting at <code>start()</code>, are available.
  + *  <li>It reuses its capacity, treating its byte array as a circular queue.  When
  + *   <code>write()</code> is called, if there is too little space at the end of the buffer,
  + *   and less than half of the capacity is currently in use, it will shift the current
  + *   contents of its buffer to position 0.
  + *  <li>When <code>toByteArray()</code> is called, if less than a quarter of the
  + *   current capacity is in use and the current capacity is greater than <code>MIN_LENGTH</code>
  + *   (currently defined as 1024), it will copy the current contents to a byte array
  + *   one half the size of the current byte array.
  + *  </ol>
  + *  
  + * <p>
    * @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    * <p>
    * Copyright (c) 2005
    * </p>
  @@ -49,10 +66,7 @@
      
      
      /**
  -    * 
       * Create a new ShrinkableByteArrayOutputStream.
  -    * 
  -    *
       */
      public ShrinkableByteArrayOutputStream()
      {
  @@ -61,10 +75,7 @@
      
      
      /**
  -    * 
       * Create a new ShrinkableByteArrayOutputStream.
  -    * 
  -    *
       */
      public ShrinkableByteArrayOutputStream(int size)
      {
  @@ -73,9 +84,8 @@
      
      
      /**
  -    *  FIXME Comment this
  -    * 
  -    * @return
  +    * Returns number of bytes of content which can be retrieved.
  +    * @return number of bytes of content which can be retrieved
       */
      public int available()
      {
  @@ -84,9 +94,8 @@
      
      
      /**
  -    *  FIXME Comment this
  -    * 
  -    * @return
  +    * Returns number of bytes of content returned by last call to <code>toByteArray()</code>.
  +    * @return number of bytes of content returned by last call to <code>toByteArray()</code>
       */
      public int bytesReturned()
      {
  @@ -95,9 +104,10 @@
      
      
      /**
  -    *  FIXME Comment this
  -    * 
  -    * @return
  +    * Returns  position of next available byte of content in byte array returned
  +    *         by <code>toByteArray()</code>.
  +    * @return position of next available byte of content in byte array returned
  +    *         by <code>toByteArray()</code>
       */
      public int start()
      {
  @@ -106,10 +116,9 @@
      
      
      /**
  -    *  FIXME Comment this
  -    * 
  -    * @param length
  -    * @return
  +    * Returns reference to internal byte array.
  +    * @param length number of bytes desired
  +    * @return reference to internal byte array
       */
      public byte[] toByteArray(int length)
      {
  
  
  
  1.5       +14 -5     JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/GrowablePipedOutputStream.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: GrowablePipedOutputStream.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/multiplex/utility/GrowablePipedOutputStream.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- GrowablePipedOutputStream.java	2 May 2006 05:15:46 -0000	1.4
  +++ GrowablePipedOutputStream.java	19 Jul 2006 23:22:52 -0000	1.5
  @@ -32,10 +32,19 @@
   
   
   /**
  - * A GrowablePipedOutputStream.
  -
  + * <code>GrowablePipedOutputStream</code> works together with
  + * <code>GrowablePipedInputStream</code> like <code>java.io.PipedInputStream</code>
  + * and <code>java.io.PipedOutputStream</code> work together, so that
  + * calling <code>GrowablePipedOutputStream.write()</code> causes bytes to be deposited with the
  + * matching <code>GrowablePipedInputStream</code>.  However, unlike
  + * <code>PipedInputStream</code>, <code>GrowablePipedInputStream</code> stores
  + * bytes in a <code>ShrinkableByteArrayOutputStream</code>, which
  + * can grow and contract dynamically in response to the number of bytes it contains.
  + *
  + * <p>
  + * For more information about method behavior, see the <code>java.io.OutputStream</code> javadoc.
    * @author <a href="mailto:r.sigal at computer.org">Ron Sigal</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    * <p>
    * Copyright (c) 2005
    * </p>
  @@ -47,7 +56,7 @@
      private boolean connected;
   
   /**
  - * Create a new GrowablePipedOutputStream.
  + * Create a new <code>GrowablePipedOutputStream</code>.
    * 
    * 
    */
  @@ -57,7 +66,7 @@
    
      
   /**
  - * Create a new GrowablePipedOutputStream.
  + * Create a new <code>GrowablePipedOutputStream</code>.
    * 
    * @param snk
    * @throws java.io.IOException
  
  
  



More information about the jboss-cvs-commits mailing list