avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/event/src/test/org/apache/excalibur/event/command/test TPCThreadManagerTestCase.java
Date Mon, 30 Sep 2002 16:17:03 GMT
bloritsch    2002/09/30 09:17:02

  Modified:    event/src/java/org/apache/excalibur/event EventHandler.java
                        Message.java Sink.java SinkClosedException.java
                        SinkFullException.java Source.java
               event/src/java/org/apache/excalibur/event/command
                        AbstractThreadManager.java CommandManager.java
                        DefaultThreadManager.java DelayedCommand.java
                        EventPipeline.java RepeatedCommand.java
                        TPCThreadManager.java TPSPThreadManager.java
                        ThreadManager.java
               event/src/java/org/apache/excalibur/event/impl
                        AbstractQueue.java FixedSizeQueue.java
               event/src/java/org/apache/excalibur/mpool Pool.java
               event/src/test/org/apache/excalibur/event/command/test
                        TPCThreadManagerTestCase.java
  Log:
  reconcile documentation (javadocs) with the work I did from home.
  
  Revision  Changes    Path
  1.9       +4 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/EventHandler.java
  
  Index: EventHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/EventHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- EventHandler.java	12 Sep 2002 14:40:45 -0000	1.8
  +++ EventHandler.java	30 Sep 2002 16:17:01 -0000	1.9
  @@ -66,11 +66,15 @@
   {
       /**
        * Handle one event at a time.
  +     *
  +     * @param element  The element that the EventHandler must process
        */
       void handleEvent( Object element );
   
       /**
        * Handle a whole array of events at a time.
  +     *
  +     * @param elements  The array of elements that the EventHandler must process
        */
       void handleEvents( Object[] elements );
   }
  
  
  
  1.8       +4 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/Message.java
  
  Index: Message.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/Message.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Message.java	12 Sep 2002 14:40:45 -0000	1.7
  +++ Message.java	30 Sep 2002 16:17:01 -0000	1.8
  @@ -67,11 +67,15 @@
       /**
        * Get the attachment associated with this Message.  If there is no
        * attachment, this method will return null.
  +     *
  +     * @return Object the attached Object
        */
       Object getAttachment();
   
       /**
        * Attach an Object to the message.
  +     *
  +     * @param attachment  Any arbitrary Object you wish to attach to the Message
        */
       void attach( Object attachment );
   
  
  
  
  1.14      +8 -9      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/Sink.java
  
  Index: Sink.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/Sink.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Sink.java	26 Sep 2002 13:02:30 -0000	1.13
  +++ Sink.java	30 Sep 2002 16:17:01 -0000	1.14
  @@ -51,7 +51,7 @@
   
   /**
    * A Sink implements the end of a finite-length event queue where
  - * <code>QueueElement</code>s are enqueued. These operations can throw a
  + * elements are enqueued. These operations can throw a
    * <code>SinkException</code> if the sink is closed or becomes full, allowing
    * event queues to support thresholding and backpressure.
    *
  @@ -69,7 +69,7 @@
       /**
        * Enqueues the given element onto the queue.
        *
  -     * @param element  The <code>QueueElement</code> to enqueue
  +     * @param element  The elements to enqueue
        * @throws SinkFullException Indicates that the sink is temporarily full.
        * @throws SinkClosedException Indicates that the sink is
        *         no longer being serviced.
  @@ -148,11 +148,6 @@
           throws SinkException;
   
       /**
  -     * Returns the number of elements waiting in this queue.
  -     */
  -    int size();
  -
  -    /**
        * Returns the length threshold of the sink. This is for informational
        * purposes only; an implementation may allow more (or fewer) new
        * entries to be enqueued than maxSize() - size(). This may be the
  @@ -169,13 +164,17 @@
        * false does not guarantee that future enqueue operations will succeed.
        * Clearly, isFull() returning true does not guarantee that they will
        * fail, since the queue may be serviced in the meantime.
  +     *
  +     * @return true if the Sink is full
        */
       boolean isFull();
   
       /**
  -     * Returns the number of QueueElements it can currently accept.  This is
  +     * Returns the number of elements it can currently accept.  This is
        * typically the difference between <code>size()</code> and
  -     * <code>maxSize()</code>.  It will return -1 if the queue is unbounded.
  +     * <code>maxSize()</code>.  It will return -1 if the sink is unbounded.
  +     *
  +     * @return the number of elements the Sink can accept
        */
       int canAccept();
   }
  
  
  
  1.7       +12 -0     jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/SinkClosedException.java
  
  Index: SinkClosedException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/SinkClosedException.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SinkClosedException.java	12 Sep 2002 14:40:45 -0000	1.6
  +++ SinkClosedException.java	30 Sep 2002 16:17:01 -0000	1.7
  @@ -64,11 +64,23 @@
    */
   public class SinkClosedException extends SinkException
   {
  +    /**
  +     * Create a <code>SinkClosedException</code> with an associated message.
  +     *
  +     * @param message  The string message to print in the stack trace
  +     */
       public SinkClosedException( String message )
       {
           super( message );
       }
   
  +    /**
  +     * Create a <code>SinkClosedException</code> with an associated message
  +     * and the original exception that caused the problem.
  +     *
  +     * @param message  The string message to print in the stack trace
  +     * @param e        The exception that caused this one.
  +     */
       public SinkClosedException( String message, Throwable e )
       {
           super( message, e );
  
  
  
  1.7       +12 -0     jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/SinkFullException.java
  
  Index: SinkFullException.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/SinkFullException.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SinkFullException.java	12 Sep 2002 14:40:45 -0000	1.6
  +++ SinkFullException.java	30 Sep 2002 16:17:01 -0000	1.7
  @@ -64,11 +64,23 @@
    */
   public class SinkFullException extends SinkException
   {
  +    /**
  +     * Create a <code>SinkFullException</code> with an associated message.
  +     *
  +     * @param message  The string message to print in the stack trace
  +     */
       public SinkFullException( String message )
       {
           super( message );
       }
   
  +    /**
  +     * Create a <code>SinkClosedException</code> with an associated message
  +     * and the original exception that caused the problem.
  +     *
  +     * @param message  The string message to print in the stack trace
  +     * @param e        The exception that caused this one.
  +     */
       public SinkFullException( String message, Throwable e )
       {
           super( message, e );
  
  
  
  1.14      +5 -1      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/Source.java
  
  Index: Source.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/Source.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Source.java	26 Sep 2002 13:02:44 -0000	1.13
  +++ Source.java	30 Sep 2002 16:17:01 -0000	1.14
  @@ -98,13 +98,17 @@
        * zero-sized array in case of a timeout while attempting to
        * obtain the mutex or if there is nothing left on the queue.
        *
  -     * @return At most <code>num</code> <code>QueueElement</code>s
from the
  +     * @param num  The maximum number of elements to dequeue
  +     *
  +     * @return At most <code>num</code> elements from the
        *         queue
        */
       Object[] dequeue( int num );
   
       /**
        * Returns the number of elements waiting in this queue.
  +     *
  +     * @return the number of elements in the queue
        */
       int size();
   
  
  
  
  1.9       +55 -0     jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/AbstractThreadManager.java
  
  Index: AbstractThreadManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/AbstractThreadManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AbstractThreadManager.java	28 Sep 2002 09:42:32 -0000	1.8
  +++ AbstractThreadManager.java	30 Sep 2002 16:17:01 -0000	1.9
  @@ -71,25 +71,51 @@
   public abstract class AbstractThreadManager extends AbstractLogEnabled
       implements Runnable, ThreadManager, Initializable, Disposable
   {
  +    /** The Mutex used in this ThreadManager */
       private final Mutex m_mutex = new Mutex();
  +
  +    /** The pipelines we are managing */
       private final HashMap m_pipelines = new HashMap();
  +
  +    /** The controls we have */
       private final LinkedList m_controls = new LinkedList();
  +
  +    /** The ThreadPool we are using */
       private ThreadPool m_threadPool;
  +
  +    /** The ThreadControl for the ThreadManager itself */
       private ThreadControl m_threadControl;
  +
  +    /** Whether we are done or not */
       private volatile boolean m_done = false;
  +
  +    /** The number of milliseconds to sleep before runngin again: 1000 (1 sec.) */
       private long m_sleepTime = 1000L;
  +
  +    /** Whether this class has been initialized or not */
       private volatile boolean m_initialized = false;
   
  +    /** Return whether the thread manager has been initialized or not */
       protected boolean isInitialized()
       {
           return m_initialized;
       }
   
  +    /**
  +     * Set the amount of time to sleep between checks on the queue
  +     *
  +     * @param sleepTime  Number of milliseconds
  +     */
       protected void setSleepTime( long sleepTime )
       {
           m_sleepTime = sleepTime;
       }
   
  +    /**
  +     * Set the ThreadPool we are using
  +     *
  +     * @param threadPool  The ThreadPool
  +     */
       protected void setThreadPool( ThreadPool threadPool )
       {
           if( null == m_threadPool )
  @@ -102,6 +128,11 @@
           }
       }
   
  +    /**
  +     * Set up the ThreadManager.  All required parameters must have already been set.
  +     *
  +     * @throws Exception if there is any problem setting up the ThreadManager
  +     */
       public void initialize() throws Exception
       {
           if( null == m_threadPool )
  @@ -115,6 +146,8 @@
   
       /**
        * Register an EventPipeline with the ThreadManager.
  +     *
  +     * @param pipeline  The pipeline we are registering
        */
       public void register( EventPipeline pipeline )
       {
  @@ -152,6 +185,8 @@
   
       /**
        * Deregister an EventPipeline with the ThreadManager
  +     *
  +     * @param pipeline  The pipeline we are de-registering
        */
       public void deregister( EventPipeline pipeline )
       {
  @@ -226,6 +261,9 @@
           }
       }
   
  +    /**
  +     * Get rid of the ThreadManager.
  +     */
       public void dispose()
       {
           deregisterAll();
  @@ -233,6 +271,10 @@
           m_threadControl = null;
       }
   
  +    /**
  +     * The code that is run in the background to manage the ThreadPool and the
  +     * EventPipelines
  +     */
       public void run()
       {
           try
  @@ -311,17 +353,30 @@
           }
       }
   
  +    /**
  +     * The PipelineRunner class pulls all the events from the Source, and puts them in
the EventHandler.
  +     * Both of those objects are part of the EventPipeline.
  +     */
       public static final class PipelineRunner
           extends AbstractLogEnabled
           implements Runnable
       {
  +        /** The pipeline we are managing */
           private final EventPipeline m_pipeline;
   
  +        /**
  +         * Create a PipelineRunner.
  +         *
  +         * @param pipeline  The EventPipeline we are running
  +         */
           protected PipelineRunner( EventPipeline pipeline )
           {
               m_pipeline = pipeline;
           }
   
  +        /**
  +         * The code that actually pulls the events from the Sources and sends them to the
event handler
  +         */
           public void run()
           {
               Source[] sources = m_pipeline.getSources();
  
  
  
  1.18      +13 -6     jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java
  
  Index: CommandManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/CommandManager.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- CommandManager.java	28 Sep 2002 09:42:32 -0000	1.17
  +++ CommandManager.java	30 Sep 2002 16:17:01 -0000	1.18
  @@ -99,15 +99,22 @@
    */
   public class CommandManager implements EventPipeline, Disposable
   {
  -    private final Queue m_queue = new DefaultQueue();
  -    private final HashMap m_signalHandlers = new HashMap();
  -    private final Mutex m_mutex = new Mutex();
  -    private final EventHandler m_eventHandler = new CommandEventHandler(
  -        Collections.unmodifiableMap( m_signalHandlers ) );
  -    private final Source[] m_sources = new Source[]{m_queue};
  +    private final Queue m_queue;
  +    private final HashMap m_signalHandlers;
  +    private final Mutex m_mutex;
  +    private final EventHandler m_eventHandler;
  +    private final Source[] m_sources;
   
  +    /**
  +     * Create the CommandManager
  +     */
       public CommandManager()
       {
  +        m_queue = new DefaultQueue();
  +        m_signalHandlers = new HashMap();
  +        m_mutex = new Mutex();
  +        m_eventHandler = new CommandEventHandler( Collections.unmodifiableMap( m_signalHandlers
) );
  +        m_sources = new Source[]{m_queue};
       }
   
       /**
  
  
  
  1.4       +5 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/DefaultThreadManager.java
  
  Index: DefaultThreadManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/DefaultThreadManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultThreadManager.java	8 Aug 2002 00:36:26 -0000	1.3
  +++ DefaultThreadManager.java	30 Sep 2002 16:17:01 -0000	1.4
  @@ -63,6 +63,11 @@
    */
   public class DefaultThreadManager extends AbstractThreadManager
   {
  +    /**
  +     * Create a new ThreadManager with the associated ThreadPool.
  +     *
  +     * @param pool  The ThreadPool we will use.
  +     */
       public DefaultThreadManager( final ThreadPool pool )
       {
           setThreadPool( pool );
  
  
  
  1.6       +2 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/DelayedCommand.java
  
  Index: DelayedCommand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/DelayedCommand.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DelayedCommand.java	7 Aug 2002 23:08:26 -0000	1.5
  +++ DelayedCommand.java	30 Sep 2002 16:17:01 -0000	1.6
  @@ -61,6 +61,8 @@
       /**
        * Sets the initial delay for the Command.  This defaults to 0
        * milliseconds.  The value must be positive.
  +     *
  +     * @return the number of milliseconds to delay
        */
       long getDelayInterval();
   }
  
  
  
  1.8       +4 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/EventPipeline.java
  
  Index: EventPipeline.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/EventPipeline.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EventPipeline.java	12 Sep 2002 14:40:45 -0000	1.7
  +++ EventPipeline.java	30 Sep 2002 16:17:01 -0000	1.8
  @@ -71,12 +71,16 @@
       /**
        * There can be many different sources to merge into a pipeline.  For the
        * CommandManager, there is only one sink.
  +     *
  +     * @return the array of sources that feed the handler
        */
       Source[] getSources();
   
       /**
        * Returns the reference to the EventHandler that the events from all the
        * Sinks get merged into.
  +     *
  +     * @return the handler for the pipeline
        */
       EventHandler getEventHandler();
   }
  
  
  
  1.5       +4 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/RepeatedCommand.java
  
  Index: RepeatedCommand.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/RepeatedCommand.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RepeatedCommand.java	7 Aug 2002 23:08:26 -0000	1.4
  +++ RepeatedCommand.java	30 Sep 2002 16:17:01 -0000	1.5
  @@ -62,6 +62,8 @@
        * as long as the CommandManager is running.  If the value is above 0,
        * the Command repeats only for that specific amount of times before it
        * is removed from the system.
  +     *
  +     * @return the number of times the command repeats
        */
       int getNumberOfRepeats();
   
  @@ -69,6 +71,8 @@
        * Gets the repeat interval so that the CommandQueue keeps it for the
        * specified amount of time before enqueuing it again.  This value must
        * not be negative.
  +     *
  +     * @return the number of milliseconds between each repeat
        */
       long getRepeatInterval();
   }
  
  
  
  1.31      +4 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPCThreadManager.java
  
  Index: TPCThreadManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPCThreadManager.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- TPCThreadManager.java	28 Sep 2002 09:56:45 -0000	1.30
  +++ TPCThreadManager.java	30 Sep 2002 16:17:01 -0000	1.31
  @@ -99,6 +99,10 @@
        *     <td>1000</td>
        *   </tr>
        * </table>
  +     *
  +     * @param parameters  The Parameters object
  +     *
  +     * @throws ParameterException if there is a problem with the parameters.
        */
       public void parameterize( Parameters parameters ) throws ParameterException
       {
  
  
  
  1.16      +31 -0     jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPSPThreadManager.java
  
  Index: TPSPThreadManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/TPSPThreadManager.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TPSPThreadManager.java	28 Sep 2002 09:56:45 -0000	1.15
  +++ TPSPThreadManager.java	30 Sep 2002 16:17:01 -0000	1.16
  @@ -78,6 +78,8 @@
        * The default constructor assumes there is a system property named "os.arch.cpus"
        * that has a default for the number of CPUs on a system.  Otherwise, the value
        * is 1.
  +     *
  +     * @throws Exception if there is any problems creating the ThreadManager
        */
       public TPSPThreadManager()
       throws Exception
  @@ -88,6 +90,12 @@
       /**
        * Constructor provides a specified number of threads per processor.  If
        * either value is less then one, then the value is rewritten as one.
  +     *
  +     * @param numProcessors        The number of processors in the machine
  +     * @param threadsPerProcessor  The number of threads to allocate for each processor
  +     * @param sleepTime            The number of milliseconds to wait between cycles
  +     *
  +     * @throws Exception when there is a problem creating the ThreadManager
        */
       public TPSPThreadManager( int numProcessors, int threadsPerProcessor, long sleepTime
)
       throws Exception
  @@ -96,6 +104,17 @@
       }
   
   
  +    /**
  +     * Constructor provides a specified number of threads per processor.  If
  +     * either value is less then one, then the value is rewritten as one.
  +     *
  +     * @param numProcessors        The number of processors in the machine
  +     * @param threadsPerProcessor  The number of threads to allocate for each processor
  +     * @param sleepTime            The number of milliseconds to wait between cycles
  +     * @param timeOut              The number of milliseconds to use as a "timeout" parameter
  +     *
  +     * @throws Exception when there is a problem creating the ThreadManager
  +     */
       public TPSPThreadManager(  int numProcessors, int threadsPerProcessor, long sleepTime,
long timeOut )
       throws Exception
       {
  @@ -111,6 +130,8 @@
   
       /**
        * Register an EventPipeline with the ThreadManager.
  +     *
  +     * @param pipeline  The pipeline we are registering
        */
       public void register( EventPipeline pipeline )
       {
  @@ -137,6 +158,8 @@
   
       /**
        * Deregister an EventPipeline with the ThreadManager
  +     *
  +     * @param pipeline  The pipeline to unregister
        */
       public void deregister( EventPipeline pipeline )
       {
  @@ -221,10 +244,18 @@
           }
       }
   
  +    /**
  +     * The PipelineRunner will run the pipelines
  +     */
       public static final class PipelineRunner implements Runnable
       {
           private final EventPipeline m_pipeline;
   
  +        /**
  +         * Create a PipelineRunner
  +         *
  +         * @param pipeline  The pipeline we are wrapping
  +         */
           protected PipelineRunner( EventPipeline pipeline )
           {
               m_pipeline = pipeline;
  
  
  
  1.5       +4 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/ThreadManager.java
  
  Index: ThreadManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/command/ThreadManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ThreadManager.java	7 Aug 2002 23:08:26 -0000	1.4
  +++ ThreadManager.java	30 Sep 2002 16:17:01 -0000	1.5
  @@ -60,11 +60,15 @@
   {
       /**
        * Register an EventPipeline with the ThreadManager.
  +     *
  +     * @param pipeline  The pipeline to register
        */
       void register( EventPipeline pipeline );
   
       /**
        * Deregister an EventPipeline with the ThreadManager
  +     *
  +     * @param pipeline  The pipeline to unregister
        */
       void deregister( EventPipeline pipeline );
   
  
  
  
  1.3       +12 -1     jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/impl/AbstractQueue.java
  
  Index: AbstractQueue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/impl/AbstractQueue.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractQueue.java	28 Sep 2002 09:42:33 -0000	1.2
  +++ AbstractQueue.java	30 Sep 2002 16:17:01 -0000	1.3
  @@ -59,12 +59,15 @@
    */
   public abstract class AbstractQueue implements Queue
   {
  -    // this object is immutable, so it can be safely shared
  +    /** An empty array used as a return value when the Queue is empty */
       protected final static Object[] EMPTY_ARRAY = new Object[ 0 ];
  +    /** The number of milliseconds to wait */
       protected long m_timeout = 0;
   
       /**
        * Default for canAccept()
  +     *
  +     * @return how many elements we can enqueue
        */
       public int canAccept()
       {
  @@ -73,6 +76,8 @@
   
       /**
        * Default maxSize to -1 which is unbounded
  +     *
  +     * @return the maximum number of elements
        */
       public int maxSize()
       {
  @@ -83,6 +88,8 @@
        * Check to see if the <code>Queue</code> is full. The method uses the
        * <code>maxSize</code> and <code>size</code> methods to determine
        * whether the queue is full.
  +     *
  +     * @return true if there is no room in the Queue
        */
       public boolean isFull()
       {
  @@ -93,6 +100,8 @@
       /**
        * Set the timeout for the <code>Queue</code> in milliseconds.  The
        * default timeout is 0, which means that we don't wait at all.
  +     *
  +     * @param millis  The number of milliseconds to block waiting for events to be enqueued
        */
       public void setTimeout( final long millis )
       {
  @@ -109,6 +118,8 @@
       /**
        * Encapsulates the logic to block the <code>Queue</code> for the amount
        * of time specified by the timeout.
  +     *
  +     * @param lock  The object used as the mutex.
        */
       protected void block( Object lock )
       {
  
  
  
  1.3       +2 -0      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/impl/FixedSizeQueue.java
  
  Index: FixedSizeQueue.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/event/impl/FixedSizeQueue.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FixedSizeQueue.java	28 Sep 2002 09:42:33 -0000	1.2
  +++ FixedSizeQueue.java	30 Sep 2002 16:17:01 -0000	1.3
  @@ -73,6 +73,8 @@
       /**
        * Create a <code>FixedSizedQueue</code> with the specified maximum size.
        * The maximum size must be 1 or more.
  +     *
  +     * @param size  The maximum number of events the Queue can handle
        */
       public FixedSizeQueue( int size )
       {
  
  
  
  1.5       +5 -1      jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/mpool/Pool.java
  
  Index: Pool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/java/org/apache/excalibur/mpool/Pool.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Pool.java	13 Aug 2002 08:15:20 -0000	1.4
  +++ Pool.java	30 Sep 2002 16:17:02 -0000	1.5
  @@ -78,6 +78,8 @@
        * Acquire an instance of the pooled object.
        *
        * @return the pooled Object instance
  +     *
  +     * @throws Exception if the Pool is not able to return an object.
        */
       Object acquire() throws Exception;
   
  @@ -92,6 +94,8 @@
        * Create a new instance of the object being pooled.
        *
        * @return the pooled Object instance
  +     *
  +     * @throws Exception if the instance cannot be created
        */
       Object newInstance() throws Exception;
   }
  
  
  
  1.10      +7 -0      jakarta-avalon-excalibur/event/src/test/org/apache/excalibur/event/command/test/TPCThreadManagerTestCase.java
  
  Index: TPCThreadManagerTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/event/src/test/org/apache/excalibur/event/command/test/TPCThreadManagerTestCase.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TPCThreadManagerTestCase.java	3 Sep 2002 17:43:00 -0000	1.9
  +++ TPCThreadManagerTestCase.java	30 Sep 2002 16:17:02 -0000	1.10
  @@ -69,6 +69,11 @@
    */
   public class TPCThreadManagerTestCase extends TestCase
   {
  +    /**
  +     * Constructor for JUnit
  +     *
  +     * @param name  The name of the test
  +     */
       public TPCThreadManagerTestCase( String name )
       {
           super( name );
  @@ -98,6 +103,8 @@
        * <p>
        * The test is not foolproof, it probably depends on preemtive
        * threads management.
  +     *
  +     * @throws Exception on error
        */
       public void testThreadContention() throws Exception
       {
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message