Author: akarasulu Date: Sat Sep 11 17:31:18 2004 New Revision: 45930 Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/Frontend.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/ResourceException.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPool.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolConfig.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/DefaultBufferPoolConfig.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/ClientDecoder.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManager.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/package.html incubator/directory/seda/trunk/api/src/java/org/apache/seda/encoder/EncoderManagerMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ClientEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectSubscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectSubscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Filter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputSubscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputSubscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestSubscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseSubscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationSubscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionEvent.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionListener.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscriber.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SubscriberMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscription.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManager.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/package.html incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ClientKey.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/KeyExpiryException.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerConfig.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManager.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputManager.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/HandlerTypeEnum.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/NoReplyHandler.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestHandler.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/SingleReplyHandler.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/TransportTypeEnum.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/session/ClientSession.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/DefaultStageConfig.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/EnqueuePredicate.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/Stage.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageConfig.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageHandler.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitor.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitorAdapter.java incubator/directory/seda/trunk/api/src/java/org/apache/seda/thread/ThreadPool.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/DefaultFrontend.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/DefaultBufferPool.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/LoggingBufferMonitor.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecodeStageHandler.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/DefaultEncoderManager.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/AbstractSubscriber.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/DefaultEventRouter.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/DefaultInputManager.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultListenerManager.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/DefaultOutputManager.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/LoggingOutputMonitor.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/DefaultStage.java incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/LoggingStageMonitor.java incubator/directory/seda/trunk/impl/src/test/org/apache/seda/buffer/DefaultBufferPoolTest.java incubator/directory/seda/trunk/impl/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/AbstractSubscriberTest.java incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/DefaultStageTest.java incubator/directory/seda/trunk/impl/src/test/org/apache/seda/listener/DefaultListenerManagerTest.java Log: Formated the code and added some missing javadocs
Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/Frontend.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/Frontend.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/Frontend.java Sat Sep 11 17:31:18 2004 @@ -14,7 +14,7 @@ * limitations under the License. * */ -package org.apache.seda ; +package org.apache.seda; /** Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/ResourceException.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/ResourceException.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/ResourceException.java Sat Sep 11 17:31:18 2004 @@ -14,14 +14,13 @@ * limitations under the License. * */ -package org.apache.seda ; +package org.apache.seda; /** * Exception thrown when a resource was needed and could not be acquired. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class ResourceException extends Exception @@ -31,17 +30,17 @@ */ public ResourceException() { - super() ; + super(); } /** * Creates a simple ResourceException with a message. * - * @param a_message a detailed message + * @param message a detailed message */ - public ResourceException( String a_message ) + public ResourceException( String message ) { - super( a_message ) ; + super( message ); } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPool.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPool.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPool.java Sat Sep 11 17:31:18 2004 @@ -14,25 +14,24 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; +package org.apache.seda.buffer; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import org.apache.seda.ResourceException ; +import org.apache.seda.ResourceException; /** * Service interface for an NIO direct memory buffer pool. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface BufferPool { /** for Avalon compatability */ - String ROLE = BufferPool.class.getName() ; + String ROLE = BufferPool.class.getName(); /** * Acquires a dedicated buffer from the buffer pool and claims interest with @@ -41,7 +40,7 @@ * @param party the object interested in the buffer * @return a claimed direct memory buffer */ - ByteBuffer getBuffer( Object party ) throws ResourceException ; + ByteBuffer getBuffer( Object party ) throws ResourceException; /** * Allows a party to claim interest on a buffer pooled by this buffer. The @@ -53,7 +52,7 @@ * @throws IllegalArgumentException if the buffer is not direct or has not * been recognized as a pooled resource of this pool. */ - void claimInterest( ByteBuffer buffer, Object party ) ; + void claimInterest( ByteBuffer buffer, Object party ); /** * Allows a party that claimed interest on a buffer to release the buffer. @@ -61,18 +60,18 @@ * their interest claim on the buffer. * * @param buffer the buffer to release - * @param owner the owner of the buffer + * @param party the party claiming interest in the buffer * @throws IllegalArgumentException if the buffer is not direct or has not * been recognized as a pooled resource of this pool. */ - void releaseClaim( ByteBuffer buffer, Object party ) ; + void releaseClaim( ByteBuffer buffer, Object party ); /** * Gets the configuration for this BufferPool. * * @return the configuration for this BufferPool */ - BufferPoolConfig getConfig() ; + BufferPoolConfig getConfig(); /** * Gets the number of interested parties that have claimed interest on a @@ -81,14 +80,14 @@ * @param buffer the buffer to get a interest count for * @return count of parties claiming interest on the buffer */ - int getInterestedCount( ByteBuffer buffer ) ; + int getInterestedCount( ByteBuffer buffer ); /** * Gets a count of the number of free buffers in this BufferPool. * * @return count of free buffers in this BufferPool */ - int getFreeCount() ; + int getFreeCount(); /** * Gets a count of the number of buffers currently being used in this @@ -96,19 +95,19 @@ * * @return count of buffers currently being used in this BufferPool */ - int getInUseCount() ; + int getInUseCount(); /** * Gets the current size of this BufferPool. * * @return the number of buffers total (free and in use) in this BufferPool */ - int size() ; + int size(); /** * Gets the name of this BufferPool * * @return the name of this BufferPool */ - String getName() ; + String getName(); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolConfig.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolConfig.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolConfig.java Sat Sep 11 17:31:18 2004 @@ -14,13 +14,12 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; +package org.apache.seda.buffer; /** * BufferPool configuration parameters used regardless of implementation. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface BufferPoolConfig @@ -30,14 +29,14 @@ * * @return the name */ - String getName() ; + String getName(); /** * The increment by which the BufferPool should grow. * * @return the increment amount for the BufferPool */ - int getIncrement() ; + int getIncrement(); /** * The size of the buffers that are pooled. Recommended settings are of @@ -45,7 +44,7 @@ * * @return the size of the pooled buffers */ - int getBufferSize() ; + int getBufferSize(); /** * Gets the initial size of the pool. This should be a multiple of the @@ -53,7 +52,7 @@ * * @return the initial pool size. */ - int getInitialSize() ; + int getInitialSize(); /** * The maximum size a BufferPool can grow to. This should be a multiple of @@ -61,5 +60,5 @@ * * @return the maximum pool size. */ - int getMaximumSize() ; + int getMaximumSize(); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,19 +14,16 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; +package org.apache.seda.buffer; -import org.apache.seda.buffer.BufferPool; - -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; /** * The BufferPool monitor interface. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface BufferPoolMonitor @@ -36,7 +33,7 @@ * * @param bp the BufferPool that grew */ - void augmented( BufferPool bp ) ; + void augmented( BufferPool bp ); /** * Monitors the release of an unclaimed buffer which cannot be released if @@ -46,8 +43,7 @@ * @param buffer the buffer that is released * @param releaser the object doing the releasing */ - void releaseOfUnclaimed( BufferPool bp, ByteBuffer buffer, - Object releaser ) ; + void releaseOfUnclaimed( BufferPool bp, ByteBuffer buffer, Object releaser ); /** * Monitors the giving of a buffer to a client. @@ -56,7 +52,7 @@ * @param buffer the buffer that is taken * @param taker the object doing the taking */ - void bufferTaken( BufferPool bp, ByteBuffer buffer, Object taker ) ; + void bufferTaken( BufferPool bp, ByteBuffer buffer, Object taker ); /** * Monitors the release of a buffer to be reclaimed onto the free list. @@ -65,7 +61,7 @@ * @param buffer the buffer that is released * @param releaser the object doing the releasing */ - void bufferReleased( BufferPool bp, ByteBuffer buffer, Object releaser ) ; + void bufferReleased( BufferPool bp, ByteBuffer buffer, Object releaser ); /** * Monitors the claim of interest in a buffer. @@ -74,7 +70,7 @@ * @param buffer the buffer that is the interest * @param claimer the object doing the interest claiming */ - void interestClaimed( BufferPool bp, ByteBuffer buffer, Object claimer ) ; + void interestClaimed( BufferPool bp, ByteBuffer buffer, Object claimer ); /** * Monitors the release of a claim on a buffer. @@ -83,8 +79,7 @@ * @param buffer the buffer that has an interest claim released * @param releaser the object doing the interest claim releasing */ - void interestReleased( BufferPool bp, ByteBuffer buffer, - Object releaser ) ; + void interestReleased( BufferPool bp, ByteBuffer buffer, Object releaser ); /** * Monitors situations where the BufferPool is in full use at its maximum @@ -93,7 +88,7 @@ * @param bp the BufferPool the where the buffer is unavailable * @param party the party trying to acquire the buffer resource */ - void resourceUnavailable( BufferPool bp, Object party ) ; + void resourceUnavailable( BufferPool bp, Object party ); /** * A party that never registered interest in a buffer is attempting to @@ -103,7 +98,7 @@ * @param buffer the buffer the party is trying to claim interest on * @param party the party trying to claim interest */ - void unregisteredParty( BufferPool bp, ByteBuffer buffer, Object party ) ; + void unregisteredParty( BufferPool bp, ByteBuffer buffer, Object party ); /** * Monitors attempts to deal with a buffer that is not a pooled resource. @@ -112,5 +107,5 @@ * @param buffer the buffer that is not pooled in the BufferPool * @param party the party that attempted the operation causing the fault */ - void nonPooledBuffer( BufferPool bp, ByteBuffer buffer, Object party ) ; + void nonPooledBuffer( BufferPool bp, ByteBuffer buffer, Object party ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/BufferPoolMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -14,21 +14,17 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; +package org.apache.seda.buffer; -import org.apache.seda.buffer.BufferPoolMonitor; -import org.apache.seda.buffer.BufferPool; - -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; /** * A BufferPoolMonitor adapter to extend to monitor only those signals that * are of interest. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class BufferPoolMonitorAdapter implements BufferPoolMonitor Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/DefaultBufferPoolConfig.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/DefaultBufferPoolConfig.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/buffer/DefaultBufferPoolConfig.java Sat Sep 11 17:31:18 2004 @@ -14,9 +14,7 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; - -import org.apache.seda.buffer.BufferPoolConfig; +package org.apache.seda.buffer; /** @@ -29,15 +27,15 @@ public class DefaultBufferPoolConfig implements BufferPoolConfig { /** the name */ - private final String m_name ; + private final String name; /** the growth increment */ - private int m_inc = 0 ; + private int inc = 0; /** the maximum pool size */ - private int m_max = 0 ; + private int max = 0; /** the initial pool size */ - private int m_ini = 0 ; + private int ini = 0; /** the size of the buffers pooled */ - private int m_size = 0 ; + private int size = 0; /** @@ -49,14 +47,14 @@ * @param ini the initial pool size * @param size the size of the buffers pooled */ - public DefaultBufferPoolConfig( String name, int inc, int max, + public DefaultBufferPoolConfig( String name, int inc, int max, int ini, int size ) { - m_name = name ; - m_inc = inc ; - m_max = max ; - m_ini = ini ; - m_size = size ; + this.name = name; + this.inc = inc; + this.max = max; + this.ini = ini; + this.size = size; } @@ -65,7 +63,7 @@ */ public int getIncrement() { - return m_inc ; + return inc; } @@ -74,7 +72,7 @@ */ public int getBufferSize() { - return m_size ; + return size; } @@ -83,7 +81,7 @@ */ public int getInitialSize() { - return m_ini ; + return ini; } @@ -92,7 +90,7 @@ */ public int getMaximumSize() { - return m_max ; + return max; } @@ -101,6 +99,6 @@ */ public String getName() { - return m_name ; + return name; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/ClientDecoder.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/ClientDecoder.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/ClientDecoder.java Sat Sep 11 17:31:18 2004 @@ -28,8 +28,7 @@ /** * A stateful decoder dedicated to a specific client. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class ClientDecoder implements StatefulDecoder, DecoderCallback Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManager.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManager.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManager.java Sat Sep 11 17:31:18 2004 @@ -22,8 +22,6 @@ import org.apache.seda.listener.ClientKey; import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.stateful.DecoderMonitor; -import org.apache.commons.codec.stateful.DecoderCallback; /** Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,12 +14,12 @@ * limitations under the License. * */ -package org.apache.seda.decoder ; +package org.apache.seda.decoder; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.seda.event.Subscriber ; +import org.apache.seda.event.Subscriber; import org.apache.seda.event.Subscriber; @@ -40,5 +40,5 @@ * @param t the throwable that prevented delivery */ void failedOnInform( Subscriber subscriber, EventObject event, - Throwable t ) ; + Throwable t ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/DecoderManagerMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -14,13 +14,12 @@ * limitations under the License. * */ -package org.apache.seda.decoder ; +package org.apache.seda.decoder; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.seda.event.Subscriber ; -import org.apache.seda.decoder.DecoderManagerMonitor; +import org.apache.seda.event.Subscriber; /** Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/package.html ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/package.html (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/decoder/package.html Sat Sep 11 17:31:18 2004 @@ -1,3 +1,3 @@ -<body> -Interfaces dealing with a client decoder service, decoder config arguments, decioder manager and decoder monitor. +<body> +Interfaces for managing client decoders. </body> Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/encoder/EncoderManagerMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/encoder/EncoderManagerMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/encoder/EncoderManagerMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,7 +14,7 @@ * limitations under the License. * */ -package org.apache.seda.encoder ; +package org.apache.seda.encoder; import org.apache.seda.listener.ClientKey; @@ -32,9 +32,9 @@ public interface EncoderManagerMonitor { void failedOnInform( EncoderManager manager, EventObject event, - Throwable t ) ; + Throwable t ); void failedOnEncode( EncoderManager manager, EventObject event, - Throwable t ) ; + Throwable t ); void failedOnEncode( EncoderManager manager, ClientKey key, Object response, - Throwable t ) ; + Throwable t ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ClientEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ClientEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ClientEvent.java Sat Sep 11 17:31:18 2004 @@ -14,12 +14,12 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.seda.listener.ClientKey ; +import org.apache.seda.listener.ClientKey; /** @@ -32,7 +32,7 @@ public abstract class ClientEvent extends EventObject { /** the unique client identifier */ - private final ClientKey m_clientKey ; + private final ClientKey clientKey; /** @@ -43,8 +43,8 @@ */ public ClientEvent( Object source, ClientKey clientKey ) { - super( source ) ; - m_clientKey = clientKey ; + super( source ); + this.clientKey = clientKey; } @@ -55,6 +55,6 @@ */ public final ClientKey getClientKey() { - return m_clientKey ; + return clientKey; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectEvent.java Sat Sep 11 17:31:18 2004 @@ -14,18 +14,16 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ClientEvent; +import org.apache.seda.listener.ClientKey; /** * Represents the acceptance by the server of a new client socket connection. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class ConnectEvent @@ -40,6 +38,6 @@ */ public ConnectEvent( Object source, ClientKey clientKey ) { - super( source, clientKey ) ; + super( source, clientKey ); } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectSubscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ConnectSubscriber.java Sat Sep 11 17:31:18 2004 @@ -14,17 +14,14 @@ * limitations under the License. * */ -package org.apache.seda.event ; - -import org.apache.seda.event.ConnectEvent; +package org.apache.seda.event; /** * Type specific Subscriber interface for ConnectEvents which represent the * acceptance of client socket connections by a server. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface ConnectSubscriber extends Subscriber @@ -34,6 +31,6 @@ * * @param event the ConnectEvent to handle */ - void inform( ConnectEvent event ) ; + void inform( ConnectEvent event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectEvent.java Sat Sep 11 17:31:18 2004 @@ -14,19 +14,16 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ClientEvent; -import org.apache.seda.listener.ClientKey; /** * Represents the acceptance by the server of a new client socket connection. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DisconnectEvent extends ClientEvent Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectSubscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/DisconnectSubscriber.java Sat Sep 11 17:31:18 2004 @@ -14,17 +14,14 @@ * limitations under the License. * */ -package org.apache.seda.event ; - -import org.apache.seda.event.DisconnectEvent; +package org.apache.seda.event; /** * Subscriber interface for DisconnectEvents which represent the loss or drop * of client socket connections by a server. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface DisconnectSubscriber extends Subscriber @@ -34,6 +31,6 @@ * * @param event the connection drop or loss event to handle */ - void inform( DisconnectEvent event ) ; + void inform( DisconnectEvent event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouter.java Sat Sep 11 17:31:18 2004 @@ -14,25 +14,21 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.util.EventObject ; +import java.util.EventObject; /** * Event service based on an exact version of the event notifier pattern found * <a href="http://www.dralasoft.com/products/eventbroker/whitepaper/">here</a>. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface EventRouter { - /** Avalon compliant service interface role */ - String ROLE = EventRouter.class.getName() ; - /** * Subscribes an event subscriber. * @@ -40,7 +36,7 @@ * @param filter an event filter if any to apply * @param subscriber the Subscriber to subscribe */ - void subscribe( Class type, Filter filter, Subscriber subscriber ) ; + void subscribe( Class type, Filter filter, Subscriber subscriber ); /** * Subscribes an event subscriber. @@ -48,21 +44,21 @@ * @param type an event type enumeration value * @param subscriber the Subscriber to subscribe */ - void subscribe( Class type, Subscriber subscriber ) ; + void subscribe( Class type, Subscriber subscriber ); /** * Unsubscribes an event subscriber. * * @param subscriber the Subscriber to unsubscribe */ - void unsubscribe( Subscriber subscriber ) ; + void unsubscribe( Subscriber subscriber ); /** * Unsubscribes an event subscriber. * * @param subscriber the Subscriber to unsubscribe */ - void unsubscribe( Class type, Subscriber subscriber ) ; + void unsubscribe( Class type, Subscriber subscriber ); /** * Fires an event synchronously in the thread of the caller to all @@ -70,5 +66,5 @@ * * @param event the event to publish */ - void publish( EventObject event ) ; + void publish( EventObject event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,10 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.util.EventObject ; +import java.util.EventObject; /** @@ -34,19 +34,19 @@ * * @param event the published event object */ - void eventPublished( EventObject event ) ; + void eventPublished( EventObject event ); /** * Monitores the addition of new subscriptions. * * @param subscription */ - void addedSubscription( Subscription subscription ) ; + void addedSubscription( Subscription subscription ); /** * Monitors the removal of new subscriptions * * @param subscription */ - void removedSubscription( Subscription subscription ) ; + void removedSubscription( Subscription subscription ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/EventRouterMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -14,12 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.event.EventRouterMonitor; - -import java.util.EventObject ; +import java.util.EventObject; /** Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Filter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Filter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Filter.java Sat Sep 11 17:31:18 2004 @@ -14,18 +14,17 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.util.EventObject ; +import java.util.EventObject; /** * A filter in the event router is used to further prune the subscriber's * interest list. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface Filter @@ -33,8 +32,8 @@ /** * Determines whether or not to inform a subscriber of an event. * - * @param a_event the event to test + * @param event the event to test * @return true if the event can be sent, false if it cannot */ - boolean accept( EventObject event ) ; + boolean accept( EventObject event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputEvent.java Sat Sep 11 17:31:18 2004 @@ -14,13 +14,11 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ClientEvent; import org.apache.seda.listener.ClientKey; @@ -34,26 +32,26 @@ * interactions required with the buffer pool without creating a dependency * on the BufferPool spi or its implementation. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public abstract class InputEvent extends ClientEvent { /** the buffer used to store the read input */ - private final ByteBuffer m_buffer ; + private final ByteBuffer buffer; /** * Creates an InputEvent - * + * + * @param source the source which created this event * @param client the key of the client * @param buffer the buffer containing the input chunk */ public InputEvent( Object source, ClientKey client, ByteBuffer buffer ) { - super( source, client ) ; - m_buffer = buffer ; + super( source, client ); + this.buffer = buffer; } @@ -64,7 +62,7 @@ * @param party the party interested in the buffer * @return the buffer with the partial input data */ - public abstract ByteBuffer claimInterest( Object party ) ; + public abstract ByteBuffer claimInterest( Object party ); /** @@ -74,7 +72,7 @@ * * @param party the party that originally claimed interest */ - public abstract void releaseInterest( Object party ) ; + public abstract void releaseInterest( Object party ); /** @@ -84,7 +82,7 @@ */ protected ByteBuffer getBuffer() { - return m_buffer ; + return buffer; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputSubscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/InputSubscriber.java Sat Sep 11 17:31:18 2004 @@ -14,17 +14,14 @@ * limitations under the License. * */ -package org.apache.seda.event ; - -import org.apache.seda.event.InputEvent; +package org.apache.seda.event; /** * Subscriber interface for InputEvents which represents the arrival of a chunk * of client socket connection data. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface InputSubscriber extends Subscriber @@ -34,6 +31,6 @@ * * @param event the input event to handle incoming data */ - void inform( InputEvent event ) ; + void inform( InputEvent event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputEvent.java Sat Sep 11 17:31:18 2004 @@ -14,13 +14,11 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ClientEvent; import org.apache.seda.listener.ClientKey; @@ -28,25 +26,37 @@ * An event used to denote output to send to a client. The output event * only connotates that data is available for output but not yet delivered. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class OutputEvent extends ClientEvent { - /** the data to send */ - private final ByteBuffer buf ; + /** the data chunk to send */ + private final ByteBuffer buf; - + + /** + * Creates an output event using a clientKey, buf of data and the source + * for this event. + * + * @param source the source which created this event + * @param clientKey the key of the client + * @param buf the buffer containing the chunk to output + */ public OutputEvent( Object source, ClientKey clientKey, ByteBuffer buf ) { - super( source, clientKey ) ; - this.buf = buf ; + super( source, clientKey ); + this.buf = buf; } - + + /** + * Gets the buffer containing the chunk to output. + * + * @return the chunk to flush back to the client + */ public ByteBuffer getBuffer() { - return buf ; + return buf; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputSubscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/OutputSubscriber.java Sat Sep 11 17:31:18 2004 @@ -16,16 +16,21 @@ */ package org.apache.seda.event ; -import org.apache.seda.event.OutputEvent; - /** + * Subscriber interface for OutputEvents which represents the need to send a + * chunk of response data to the client. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface OutputSubscriber extends Subscriber { + /** + * Informs a Subscriber of an OutputEvent denoting the need to send a + * chunk of response data back to a client. + * + * @param event the event carrying the chunk payload to send + */ void inform( OutputEvent event ) ; } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestEvent.java Sat Sep 11 17:31:18 2004 @@ -14,11 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ClientEvent; +import org.apache.seda.listener.ClientKey; /** @@ -30,7 +29,7 @@ public class RequestEvent extends ClientEvent { /** the request message */ - private final Object request ; + private final Object request; /** @@ -42,8 +41,8 @@ */ public RequestEvent( Object source, ClientKey clientKey, Object request ) { - super( source, clientKey ) ; - this.request = request ; + super( source, clientKey ); + this.request = request; } @@ -54,6 +53,6 @@ */ public Object getRequest() { - return request ; + return request; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestSubscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/RequestSubscriber.java Sat Sep 11 17:31:18 2004 @@ -16,14 +16,11 @@ */ package org.apache.seda.event ; -import org.apache.seda.event.RequestEvent; - /** * A subscriber that recieves RequestEvents. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface RequestSubscriber extends Subscriber Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseEvent.java Sat Sep 11 17:31:18 2004 @@ -14,10 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.listener.ClientKey ; +import org.apache.seda.listener.ClientKey; /** @@ -31,7 +31,7 @@ public class ResponseEvent extends ClientEvent { /** the response message */ - private final Object response ; + private final Object response; /** @@ -42,11 +42,10 @@ * @param clientKey the key of the client associated with this event * @param response the response message */ - public ResponseEvent( Object source, ClientKey clientKey, - Object response ) + public ResponseEvent( Object source, ClientKey clientKey, Object response ) { - super( source, clientKey ) ; - this.response = response ; + super( source, clientKey ); + this.response = response; } @@ -57,6 +56,6 @@ */ public Object getResponse() { - return response ; + return response; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseSubscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/ResponseSubscriber.java Sat Sep 11 17:31:18 2004 @@ -14,9 +14,7 @@ * limitations under the License. * */ -package org.apache.seda.event ; - -import org.apache.seda.event.ResponseEvent; +package org.apache.seda.event; /** @@ -33,5 +31,5 @@ * * @param event the response event to handle an incoming client request */ - void inform( ResponseEvent event ) ; + void inform( ResponseEvent event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationEvent.java Sat Sep 11 17:31:18 2004 @@ -14,11 +14,9 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.session.ClientSession ; -import org.apache.seda.event.ClientEvent; import org.apache.seda.session.ClientSession; @@ -28,14 +26,13 @@ * the directory may destroy an existing session and create another one without * droping the socket connection. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class SessionCreationEvent extends ClientEvent { /** the newly created client session */ - private final ClientSession m_session ; + private final ClientSession session; /** @@ -47,8 +44,8 @@ */ public SessionCreationEvent( Object source, ClientSession session ) { - super( source, session.getClientKey() ) ; - m_session = session ; + super( source, session.getClientKey() ); + this.session = session; } @@ -59,7 +56,7 @@ */ public ClientSession getClientSession() { - return m_session ; + return this.session; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationSubscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionCreationSubscriber.java Sat Sep 11 17:31:18 2004 @@ -16,14 +16,11 @@ */ package org.apache.seda.event ; -import org.apache.seda.event.SessionCreationEvent; - /** * Type safe Subscriber for session creation events for clients. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface SessionCreationSubscriber extends Subscriber @@ -33,5 +30,5 @@ * * @param event the event to inform this Subscriber about. */ - public void inform( SessionCreationEvent event ) ; + public void inform( SessionCreationEvent event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionEvent.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionEvent.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionEvent.java Sat Sep 11 17:31:18 2004 @@ -14,11 +14,9 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.session.ClientSession ; -import org.apache.seda.event.ClientEvent; import org.apache.seda.session.ClientSession; @@ -28,14 +26,13 @@ * the directory may destroy an existing session and create another one without * droping the socket connection. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class SessionDestructionEvent extends ClientEvent { /** the newly created client session */ - private final ClientSession m_session ; + private final ClientSession session; /** @@ -47,8 +44,8 @@ */ public SessionDestructionEvent( Object source, ClientSession session ) { - super( source, session.getClientKey() ) ; - m_session = session ; + super( source, session.getClientKey() ); + this.session = session; } @@ -59,7 +56,7 @@ */ public ClientSession getClientSession() { - return m_session ; + return this.session; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionListener.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionListener.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SessionDestructionListener.java Sat Sep 11 17:31:18 2004 @@ -14,16 +14,13 @@ * limitations under the License. * */ -package org.apache.seda.event ; - -import org.apache.seda.event.SessionDestructionEvent; +package org.apache.seda.event; /** * Type safe Subscriber interested in session deletion events. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface SessionDestructionListener @@ -33,5 +30,5 @@ * * @param event the destruction event to inform of */ - public void inform( SessionDestructionEvent event ) ; + public void inform( SessionDestructionEvent event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscriber.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscriber.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscriber.java Sat Sep 11 17:31:18 2004 @@ -14,7 +14,7 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; import java.util.EventObject ; @@ -24,10 +24,8 @@ /** * A Subscriber from the Event Notifier pattern. * - * @see <a href="http://www.dralasoft.com/products/eventbroker/whitepaper/"> - * Event Notifier Pattern</a> - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @see <a href="http://www.dralasoft.com/products/eventbroker/whitepaper/">Event Notifier Pattern</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface Subscriber extends EventListener @@ -37,5 +35,5 @@ * * @param event the event notified of */ - void inform( EventObject event ) ; + void inform( EventObject event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SubscriberMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SubscriberMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/SubscriberMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,19 +14,16 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.event.Subscriber; - -import java.util.EventObject ; +import java.util.EventObject; /** * Monitors noteworthy Subscriber activities. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface SubscriberMonitor @@ -39,5 +36,5 @@ * @param throwable the resulting failure exception if any */ void failedOnInform( Subscriber subscriber, EventObject eventObject, - Throwable throwable ) ; + Throwable throwable ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscription.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscription.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/event/Subscription.java Sat Sep 11 17:31:18 2004 @@ -14,27 +14,23 @@ * limitations under the License. * */ -package org.apache.seda.event ; - -import org.apache.seda.event.Filter; -import org.apache.seda.event.Subscriber; +package org.apache.seda.event; /** - * A subscription bean. + * A bean representing a subscription. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class Subscription { /** the filter if any used to filter out events */ - private final Filter m_filter ; + private final Filter filter; /** the event class */ - private final Class m_type ; + private final Class type; /** the subscriber */ - private final Subscriber m_subscriber ; + private final Subscriber subscriber; /** @@ -47,9 +43,9 @@ */ public Subscription( Class type, Filter filter, Subscriber subscriber ) { - m_type = type ; - m_filter = filter ; - m_subscriber = subscriber ; + this.type = type; + this.filter = filter; + this.subscriber = subscriber; } @@ -60,7 +56,7 @@ */ public Class getType() { - return m_type ; + return type; } @@ -71,7 +67,7 @@ */ public Filter getFilter() { - return m_filter ; + return filter; } @@ -82,7 +78,7 @@ */ public Subscriber getSubscriber() { - return m_subscriber ; + return subscriber; } @@ -96,40 +92,40 @@ { if ( this == obj ) { - return true ; + return true; } if ( ! ( obj instanceof Subscription ) ) { - return false ; + return false; } - final Subscription l_subscription = ( Subscription ) obj ; + final Subscription l_subscription = ( Subscription ) obj; - if ( ! m_type.equals( l_subscription.getType() ) ) + if ( ! type.equals( l_subscription.getType() ) ) { - return false ; + return false; } - if ( m_filter != null ) + if ( filter != null ) { if ( l_subscription.getFilter() == null ) { - return false ; + return false; } - if ( ! m_filter.equals( l_subscription.getFilter() ) ) + if ( ! filter.equals( l_subscription.getFilter() ) ) { - return false ; + return false; } } - if ( ! m_subscriber.equals( l_subscription.getSubscriber() ) ) + if ( ! subscriber.equals( l_subscription.getSubscriber() ) ) { - return false ; + return false; } - return true ; + return true; } @@ -145,11 +141,11 @@ */ public int hashCode() { - int l_result = 17 ; - l_result = 37 * l_result + m_type.hashCode() ; + int l_result = 17; + l_result = 37 * l_result + type.hashCode(); l_result = 37 * l_result + - ( m_filter != null ? m_filter.hashCode() : 0 ) ; - l_result = 37 * l_result + m_subscriber.hashCode() ; - return l_result ; + ( filter != null ? filter.hashCode() : 0 ); + l_result = 37 * l_result + subscriber.hashCode(); + return l_result; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManager.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManager.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManager.java Sat Sep 11 17:31:18 2004 @@ -14,15 +14,14 @@ * limitations under the License. * */ -package org.apache.seda.input ; +package org.apache.seda.input; /** * Service interface for server modules that monitor incomming PDU requests on * a client's inputs. * - * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a> - * @author $Author$ + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface InputManager Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,30 +14,26 @@ * limitations under the License. * */ -package org.apache.seda.input ; +package org.apache.seda.input; -import java.io.IOException ; +import java.io.IOException; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; -import java.nio.channels.Selector ; -import java.nio.channels.SocketChannel ; +import java.nio.channels.Selector; +import java.nio.channels.SocketChannel; -import org.apache.seda.ResourceException ; -import org.apache.seda.buffer.BufferPool ; +import org.apache.seda.ResourceException; +import org.apache.seda.buffer.BufferPool; import org.apache.seda.listener.ClientKey; -import org.apache.seda.listener.ClientKey ; import org.apache.seda.listener.KeyExpiryException; -import org.apache.seda.listener.KeyExpiryException ; -import org.apache.seda.ResourceException; /** * Monitors input activity managed by the the InputManager. * - * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a> - * @author $Author$ + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface InputManagerMonitor @@ -47,7 +43,7 @@ * * @param key the key of the client that was disconnected */ - void disconnectedClient( ClientKey key ) ; + void disconnectedClient( ClientKey key ); /** * Monitors channel registrations which occur on client sockets. @@ -55,7 +51,7 @@ * @param key the key of the client whose channel got registered * @param selector the selector used to register the client's channel */ - void registeredChannel( ClientKey key, Selector selector ) ; + void registeredChannel( ClientKey key, Selector selector ); /** * Monitors returns from the selector denoting a timeout or a wakeup due to @@ -63,14 +59,14 @@ * * @param selector the selector that has returned */ - void selectorReturned( Selector selector ) ; + void selectorReturned( Selector selector ); /** * Monitors input read from a client socket channel. * * @param key the key of the client sending the request */ - void inputRecieved( ClientKey key ) ; + void inputRecieved( ClientKey key ); /** * Monitors input read from a client socket channel. @@ -78,7 +74,7 @@ * @param buffer the input recieved * @param key the key of the client sending the request */ - void inputRecieved( ByteBuffer buffer, ClientKey key ) ; + void inputRecieved( ByteBuffer buffer, ClientKey key ); // ------------------------------------------------------------------------ @@ -92,7 +88,7 @@ * @param selector the selector the select was called on * @param fault the faulting exception */ - void selectFailure( Selector selector, IOException fault ) ; + void selectFailure( Selector selector, IOException fault ); /** * Monitors attempts to use client key's that have expired. @@ -100,7 +96,7 @@ * @param key the client key that expired * @param fault the faulting exception */ - void keyExpiryFailure( ClientKey key, KeyExpiryException fault ) ; + void keyExpiryFailure( ClientKey key, KeyExpiryException fault ); /** * Monitors failed read attempts from client socket channel. @@ -108,7 +104,7 @@ * @param key the key of the client the read failed on * @param fault the faulting exception */ - void readFailed( ClientKey key, IOException fault ) ; + void readFailed( ClientKey key, IOException fault ); /** * Monitors failed attempts to acquire a buffer from the BufferPool. @@ -116,7 +112,7 @@ * @param bp the buffer pool a buffer was requested from * @param fault the faulting exception */ - void bufferUnavailable( BufferPool bp, ResourceException fault ) ; + void bufferUnavailable( BufferPool bp, ResourceException fault ); /** * Monitors failures to register channels with a selector. @@ -127,7 +123,7 @@ * @param fault the faulting exception */ void channelRegistrationFailure( Selector selector, SocketChannel channel, - int selectionKey, IOException fault ) ; + int selectionKey, IOException fault ); /** * Monitors failures to close a client's socket channel. @@ -135,21 +131,21 @@ * @param channel the channel that failed to close * @param fault the faulting exception */ - void channelCloseFailure( SocketChannel channel, IOException fault ) ; + void channelCloseFailure( SocketChannel channel, IOException fault ); /** * Monitors the occurrence of successful select timeouts on a selector * * @param selector */ - void selectTimedOut( Selector selector ) ; + void selectTimedOut( Selector selector ); /** * A select call is about to be made. * * @param selector the selector on which the select is called */ - void enteringSelect( Selector selector ) ; + void enteringSelect( Selector selector ); /** * Monitors the removal of stale keys from the selection set. This occurs @@ -160,5 +156,5 @@ * * @param key the selection key of the client that was cleaned up */ - void cleanedStaleKey( SelectionKey key ) ; + void cleanedStaleKey( SelectionKey key ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/InputManagerMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -14,30 +14,28 @@ * limitations under the License. * */ -package org.apache.seda.input ; +package org.apache.seda.input; -import java.io.IOException ; +import java.io.IOException; -import java.nio.ByteBuffer ; -import java.nio.channels.Selector ; -import java.nio.channels.SelectionKey ; -import java.nio.channels.SocketChannel ; +import java.nio.ByteBuffer; +import java.nio.channels.Selector; +import java.nio.channels.SelectionKey; +import java.nio.channels.SocketChannel; -import org.apache.commons.lang.exception.ExceptionUtils ; +import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.seda.ResourceException ; -import org.apache.seda.input.InputManagerMonitor; -import org.apache.seda.buffer.BufferPool ; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.listener.KeyExpiryException ; +import org.apache.seda.ResourceException; +import org.apache.seda.buffer.BufferPool; +import org.apache.seda.listener.ClientKey; +import org.apache.seda.listener.KeyExpiryException; /** * An adaptor for the InputManagerMonitor interface. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class InputManagerMonitorAdapter implements InputManagerMonitor @@ -85,7 +83,7 @@ */ public void selectFailure( Selector selector, IOException fault ) { - System.err.println( ExceptionUtils.getFullStackTrace( fault ) ) ; + System.err.println( ExceptionUtils.getFullStackTrace( fault ) ); } @@ -96,7 +94,7 @@ */ public void keyExpiryFailure( ClientKey key, KeyExpiryException fault ) { - System.err.println( ExceptionUtils.getFullStackTrace( fault ) ) ; + System.err.println( ExceptionUtils.getFullStackTrace( fault ) ); } @@ -106,7 +104,7 @@ */ public void readFailed( ClientKey key, IOException fault ) { - System.err.println( ExceptionUtils.getFullStackTrace( fault ) ) ; + System.err.println( ExceptionUtils.getFullStackTrace( fault ) ); } @@ -117,7 +115,7 @@ */ public void bufferUnavailable( BufferPool bp, ResourceException fault ) { - System.err.println( ExceptionUtils.getFullStackTrace( fault ) ) ; + System.err.println( ExceptionUtils.getFullStackTrace( fault ) ); } @@ -129,7 +127,7 @@ public void channelRegistrationFailure( Selector selector, SocketChannel channel, int key, IOException fault) { - System.err.println( ExceptionUtils.getFullStackTrace( fault ) ) ; + System.err.println( ExceptionUtils.getFullStackTrace( fault ) ); } @@ -140,7 +138,7 @@ public void channelCloseFailure( SocketChannel channel, IOException fault ) { - System.err.println( ExceptionUtils.getFullStackTrace( fault ) ) ; + System.err.println( ExceptionUtils.getFullStackTrace( fault ) ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/package.html ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/package.html (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/input/package.html Sat Sep 11 17:31:18 2004 @@ -1,3 +1,3 @@ -<body> -Interfaces defining the input manager and monitor. +<body> +Interfaces defining the input manager and its monitor. </body> Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ClientKey.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ClientKey.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ClientKey.java Sat Sep 11 17:31:18 2004 @@ -14,12 +14,12 @@ * limitations under the License. * */ -package org.apache.seda.listener ; +package org.apache.seda.listener; -import java.net.Socket ; +import java.net.Socket; -import java.io.IOException ; +import java.io.IOException; /** @@ -38,8 +38,7 @@ * @todo do we really need these lock objects? * @todo why are we carrying around the damn socket? * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public final class ClientKey @@ -49,16 +48,16 @@ // ---------------------------------------------- /** Input channel synchronization object */ - private final Object m_inputLock = new Object() ; + private final Object inputLock = new Object(); /** Output channel synchronization object */ - private final Object m_outputLock = new Object() ; + private final Object outputLock = new Object(); /** Unique key or client id */ - private final String m_clientId ; + private final String clientId; /** Socket connection to client */ - private final Socket m_socket ; + private final Socket socket; /** Whether or not this key has expired: the client has disconnected. */ - private boolean m_hasExpired = false ; + private boolean hasExpired = false; // ---------------------------------------------- @@ -83,17 +82,17 @@ ClientKey( final Socket a_socket ) { // build the key ... - StringBuffer l_buf = new StringBuffer() ; - l_buf.append( a_socket.getLocalAddress().getHostAddress() ) ; - l_buf.append( ':' ) ; - l_buf.append( a_socket.getLocalPort() ).append( "<-" ) ; - l_buf.append( a_socket.getInetAddress().getHostAddress() ) ; - l_buf.append( ':' ) ; - l_buf.append( a_socket.getPort() ) ; + StringBuffer l_buf = new StringBuffer(); + l_buf.append( a_socket.getLocalAddress().getHostAddress() ); + l_buf.append( ':' ); + l_buf.append( a_socket.getLocalPort() ).append( "<-" ); + l_buf.append( a_socket.getInetAddress().getHostAddress() ); + l_buf.append( ':' ); + l_buf.append( a_socket.getPort() ); // set finals ... - m_clientId = l_buf.toString() ; - m_socket = a_socket ; + clientId = l_buf.toString(); + socket = a_socket; } @@ -113,8 +112,8 @@ */ public String getClientId() throws KeyExpiryException { - checkExpiry() ; - return m_clientId ; + checkExpiry(); + return clientId; } @@ -125,8 +124,8 @@ */ public Socket getSocket() throws KeyExpiryException { - checkExpiry() ; - return m_socket ; + checkExpiry(); + return socket; } @@ -138,8 +137,8 @@ */ public String getClientAddress() throws KeyExpiryException { - checkExpiry() ; - return m_socket.getInetAddress().getHostAddress() ; + checkExpiry(); + return socket.getInetAddress().getHostAddress(); } @@ -151,8 +150,8 @@ */ public String getClientHost() throws KeyExpiryException { - checkExpiry() ; - return m_socket.getInetAddress().getHostName() ; + checkExpiry(); + return socket.getInetAddress().getHostName(); } @@ -169,8 +168,8 @@ */ public Object getOutputLock() throws KeyExpiryException { - checkExpiry() ; - return m_outputLock ; + checkExpiry(); + return outputLock; } @@ -182,8 +181,8 @@ */ public Object getInputLock() throws KeyExpiryException { - checkExpiry() ; - return m_inputLock ; + checkExpiry(); + return inputLock; } @@ -202,7 +201,7 @@ */ public boolean hasExpired() { - return m_hasExpired ; + return hasExpired; } @@ -214,11 +213,11 @@ */ void expire() throws IOException { - m_hasExpired = true ; + hasExpired = true; - if ( null != m_socket ) + if ( null != socket ) { - m_socket.close() ; + socket.close(); } } @@ -237,9 +236,9 @@ */ void checkExpiry() throws KeyExpiryException { - if( m_hasExpired ) + if( hasExpired ) { - throw new KeyExpiryException( this ) ; + throw new KeyExpiryException( this ); } } @@ -256,7 +255,7 @@ */ public String toString() { - return m_clientId ; + return clientId; } @@ -268,7 +267,7 @@ */ public int hashCode() { - return m_clientId.hashCode() ; + return clientId.hashCode(); } @@ -286,19 +285,19 @@ { if( this == an_obj ) { - return true ; + return true; } else if( an_obj instanceof String ) { - return m_clientId.equals( an_obj ) ; + return clientId.equals( an_obj ); } else if( an_obj instanceof ClientKey ) { - return ( ( ClientKey ) an_obj ).m_clientId.equals( m_clientId ) ; + return ( ( ClientKey ) an_obj ).clientId.equals( clientId ); } else { - return m_clientId.equals( an_obj.toString() ) ; + return clientId.equals( an_obj.toString() ); } } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/KeyExpiryException.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/KeyExpiryException.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/KeyExpiryException.java Sat Sep 11 17:31:18 2004 @@ -14,49 +14,46 @@ * limitations under the License. * */ -package org.apache.seda.listener ; +package org.apache.seda.listener; -import org.apache.seda.listener.ClientKey; - -import java.io.IOException ; +import java.io.IOException; /** * An exception that is raised when the accessor methods on an expired ClientKey * are used. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class KeyExpiryException extends IOException { /** the key that caused this exception by being accessed after expiring */ - private final ClientKey m_key ; + private final ClientKey key; /** * Constructs an Exception without a message. * - * @param a_key the unique key for the client which expired. + * @param key the unique key for the client which expired. */ - public KeyExpiryException( ClientKey a_key ) + public KeyExpiryException( ClientKey key ) { - super() ; - m_key = a_key ; + super(); + this.key = key; } /** * Constructs an Exception with a detailed message. * - * @param a_key the unique key for the client which expired. - * @param a_message The message associated with the exception. + * @param key the unique key for the client which expired. + * @param message The message associated with the exception. */ - public KeyExpiryException( ClientKey a_key, String a_message ) + public KeyExpiryException( ClientKey key, String message ) { - super( a_message ); - m_key = a_key ; + super( message ); + this.key = key; } @@ -67,6 +64,6 @@ */ public ClientKey getClientKey() { - return m_key ; + return key; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerConfig.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerConfig.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerConfig.java Sat Sep 11 17:31:18 2004 @@ -14,17 +14,16 @@ * limitations under the License. * */ -package org.apache.seda.listener ; +package org.apache.seda.listener; + -import org.apache.seda.protocol.InetServiceEntry; import org.apache.seda.protocol.InetServiceEntry; /** * A server listener configuration interface. * - * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a> - * @author $Author$ + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface ListenerConfig @@ -34,21 +33,21 @@ * * @return client connection backlog */ - public int getBacklog() ; + public int getBacklog(); /** * Gets the ip interface address this ListenerConfig listens on. * * @return the ip address octets i.e. { 127,0,0,1 } for 127.0.0.1 */ - public byte[] getAddress() ; + public byte[] getAddress(); /** * Gets whether or not the listener is for establishing secure connections. * * @return true if ssl is used to secure the connection, false otherwise. */ - public boolean isSecure() ; + public boolean isSecure(); /** * Gets the URL for this ListenerConfig using the specified ip address and @@ -57,7 +56,7 @@ * * @return the URL with scheme like so ldap://localhost:389 */ - public String getURL() ; + public String getURL(); /** * Gets the InetServiceEntry associated with this ListenerConfig. Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManager.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManager.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManager.java Sat Sep 11 17:31:18 2004 @@ -14,10 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.listener ; +package org.apache.seda.listener; -import java.io.IOException ; +import java.io.IOException; /** @@ -29,21 +29,18 @@ */ public interface ListenerManager { - /** Avalon likes to have the ROLE associated with the service interface */ - String ROLE = ListenerManager.class.getName() ; - /** * Binds and registers a server listener. * - * @param a_listenerConfig the listener to register and bind + * @param listenerConfig the listener to register and bind */ - public void bind( ListenerConfig a_listenerConfig ) throws IOException ; + public void bind( ListenerConfig listenerConfig ) throws IOException; /** * Unbinds and unregisters a server listener. * - * @param a_listenerConfig the listener to unregister and unbind + * @param listenerConfig the listener to unregister and unbind * @throws IOException if there is a problem unbinding a listener */ - public void unbind( ListenerConfig a_listenerConfig ) throws IOException ; + public void unbind( ListenerConfig listenerConfig ) throws IOException; } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,14 +14,12 @@ * limitations under the License. * */ -package org.apache.seda.listener ; +package org.apache.seda.listener; -import org.apache.seda.listener.ClientKey; - -import java.io.IOException ; -import java.nio.channels.Selector ; -import java.nio.channels.SelectionKey ; +import java.io.IOException; +import java.nio.channels.Selector; +import java.nio.channels.SelectionKey; /** @@ -39,92 +37,92 @@ /** * Monitors when the ListnenerManager starts. */ - void started() ; + void started(); /** * Monitors when the ListnenerManager stops. */ - void stopped() ; + void stopped(); /** * Monitors bind occurences. * - * @param a_listenerConfig the listener just bound to a port + * @param listenerConfig the listener just bound to a port */ - void bindOccured( ListenerConfig a_listenerConfig ) ; + void bindOccured( ListenerConfig listenerConfig ); /** * Monitors unbind occurences. * - * @param a_listenerConfig the listener just unbound from a port + * @param listenerConfig the listener just unbound from a port */ - void unbindOccured( ListenerConfig a_listenerConfig ) ; + void unbindOccured( ListenerConfig listenerConfig ); /** * Monitors the occurrence of successful socket accept attempts * - * @param a_key + * @param key */ - void acceptOccured( SelectionKey a_key ) ; + void acceptOccured( SelectionKey key ); /** * Monitors the occurrence of successful select calls on a selector * - * @param a_selector + * @param selector */ - void selectOccured( Selector a_selector ) ; + void selectOccured( Selector selector ); /** * Monitors the occurrence of successful select timeouts on a selector * - * @param a_selector + * @param selector */ - void selectTimedOut( Selector a_selector ) ; + void selectTimedOut( Selector selector ); /** * Monitors bind failures. * - * @param a_listenerConfig the listener whose bind attempt failed - * @param a_failure the exception resulting from the failure + * @param listenerConfig the listener whose bind attempt failed + * @param failure the exception resulting from the failure */ - void failedToBind( ListenerConfig a_listenerConfig, IOException a_failure ) ; + void failedToBind( ListenerConfig listenerConfig, IOException failure ); /** * Monitors unbind failures. * - * @param a_listenerConfig the listener whose unbind attempt failed - * @param a_failure the exception resulting from the failure + * @param listenerConfig the listener whose unbind attempt failed + * @param failure the exception resulting from the failure */ - void failedToUnbind( ListenerConfig a_listenerConfig, IOException a_failure ) ; + void failedToUnbind( ListenerConfig listenerConfig, IOException failure ); /** * Monitors expiration failures on client keys. * - * @param a_key the client key that caused the failure - * @param a_failure the exception resulting from the failure + * @param key the client key that caused the failure + * @param failure the exception resulting from the failure */ - void failedToExpire( ClientKey a_key, IOException a_failure ) ; + void failedToExpire( ClientKey key, IOException failure ); /** * Monitors accept failures on socket channels. * - * @param a_key the selector key associated with the channel - * @param a_failure the exception resulting from the failure + * @param key the selector key associated with the channel + * @param failure the exception resulting from the failure */ - void failedToAccept( SelectionKey a_key, IOException a_failure ) ; + void failedToAccept( SelectionKey key, IOException failure ); /** * Monitors select failures on a selector. * - * @param a_selector the selector on which the select failed - * @param a_failure the exception resulting from the failure + * @param selector the selector on which the select failed + * @param failure the exception resulting from the failure */ - void failedToSelect( Selector a_selector, IOException a_failure ) ; + void failedToSelect( Selector selector, IOException failure ); /** * A select call is about to be made. * - * @param a_selector the selector on which the select is called + * @param selector the selector on which the select is called */ - void enteringSelect( Selector a_selector ) ; + void enteringSelect( Selector selector ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/listener/ListenerManagerMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -21,7 +21,7 @@ import java.io.IOException; /** - * Document me. + * An null do nothing adapter for the listener manager. * * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ @@ -36,67 +36,67 @@ { } - public void bindOccured( ListenerConfig a_listenerConfig ) + public void bindOccured( ListenerConfig listenerConfig ) { } - public void unbindOccured( ListenerConfig a_listenerConfig ) + public void unbindOccured( ListenerConfig listenerConfig ) { } - public void acceptOccured( SelectionKey a_key ) + public void acceptOccured( SelectionKey key ) { } - public void selectOccured( Selector a_selector ) + public void selectOccured( Selector selector ) { } - public void selectTimedOut( Selector a_selector ) + public void selectTimedOut( Selector selector ) { } - public void failedToBind( ListenerConfig a_listenerConfig, IOException a_failure ) + public void failedToBind( ListenerConfig listenerConfig, IOException failure ) { - if ( a_failure != null ) + if ( failure != null ) { - a_failure.printStackTrace(); + failure.printStackTrace(); } } - public void failedToUnbind( ListenerConfig a_listenerConfig, IOException a_failure ) + public void failedToUnbind( ListenerConfig listenerConfig, IOException failure ) { - if ( a_failure != null ) + if ( failure != null ) { - a_failure.printStackTrace(); + failure.printStackTrace(); } } - public void failedToExpire( ClientKey a_key, IOException a_failure ) + public void failedToExpire( ClientKey key, IOException failure ) { - if ( a_failure != null ) + if ( failure != null ) { - a_failure.printStackTrace(); + failure.printStackTrace(); } } - public void failedToAccept( SelectionKey a_key, IOException a_failure ) + public void failedToAccept( SelectionKey key, IOException failure ) { - if ( a_failure != null ) + if ( failure != null ) { - a_failure.printStackTrace(); + failure.printStackTrace(); } } - public void failedToSelect( Selector a_selector, IOException a_failure ) + public void failedToSelect( Selector selector, IOException failure ) { - if ( a_failure != null ) + if ( failure != null ) { - a_failure.printStackTrace(); + failure.printStackTrace(); } } - public void enteringSelect( Selector a_selector ) + public void enteringSelect( Selector selector ) { } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputManager.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputManager.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputManager.java Sat Sep 11 17:31:18 2004 @@ -14,28 +14,24 @@ * limitations under the License. * */ -package org.apache.seda.output ; +package org.apache.seda.output; -import java.io.IOException ; +import java.io.IOException; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import org.apache.seda.listener.ClientKey ; +import org.apache.seda.listener.ClientKey; /** * Service interface used to manage output. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev: 9555 $ */ public interface OutputManager { - /** Old Avalon requirement for a service role */ - String ROLE = OutputManager.class.getName() ; - /** * Writes or rather sends a peice of PDU data to a client. * @@ -43,5 +39,5 @@ * @param buf the buffer of PDU data * @throws IOException if there is a failure while sending the data */ - void write( ClientKey key, ByteBuffer buf ) throws IOException ; + void write( ClientKey key, ByteBuffer buf ) throws IOException; } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,15 +14,15 @@ * limitations under the License. * */ -package org.apache.seda.output ; +package org.apache.seda.output; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ConnectEvent ; -import org.apache.seda.event.DisconnectEvent ; -import org.apache.seda.listener.KeyExpiryException ; +import org.apache.seda.listener.ClientKey; +import org.apache.seda.event.ConnectEvent; +import org.apache.seda.event.DisconnectEvent; +import org.apache.seda.listener.KeyExpiryException; import org.apache.seda.event.ConnectEvent; import org.apache.seda.listener.ClientKey; import org.apache.seda.output.OutputManager; @@ -44,7 +44,7 @@ * @param key the key of the client data is sent to * @param t the fault causing the failure */ - void failedOnWrite( OutputManager manager, ClientKey key, Throwable t ) ; + void failedOnWrite( OutputManager manager, ClientKey key, Throwable t ); /** * Monitors send events to a client. @@ -52,7 +52,7 @@ * @param manager the OutputManager sending the data * @param key the key of the client data is sent to */ - void writeOccurred( OutputManager manager, ClientKey key ) ; + void writeOccurred( OutputManager manager, ClientKey key ); /** * Monitors locks acquired to write to a client's output channel. @@ -60,7 +60,7 @@ * @param manager the OutputManager write locking * @param key the key of the client lock is for */ - void writeLockAcquired( OutputManager manager, ClientKey key ) ; + void writeLockAcquired( OutputManager manager, ClientKey key ); /** * Monitors situations where a channel is no longer present for a client. @@ -68,7 +68,7 @@ * @param manager the OutputManager detecting the missing channel * @param key the key of the client the channel was missing from */ - void channelMissing( OutputManager manager, ClientKey key ) ; + void channelMissing( OutputManager manager, ClientKey key ); /** * Monitors failures resulting from accessing a client key that has been @@ -79,7 +79,7 @@ * @param e the key expiration exception */ void keyExpired( OutputManager manager, ClientKey key, - KeyExpiryException e ) ; + KeyExpiryException e ); /** * Monitors failures on inform events to subscriber methods. @@ -89,7 +89,7 @@ * @param fault the faulting exception associated with the failure */ void failedOnInform( OutputManager manager, EventObject event, - Throwable fault ) ; + Throwable fault ); /** * Called when connections are established and clients are registered with @@ -98,7 +98,7 @@ * @param manager the output manager with which a client was registered * @param event the ConnectEvent that caused registration */ - void addedClient( OutputManager manager, ConnectEvent event ) ; + void addedClient( OutputManager manager, ConnectEvent event ); /** * Called when connections are dropped and clients are unregistered with @@ -107,5 +107,5 @@ * @param manager the output manager with which a client was unregistered * @param event the DisconnectEvent that caused unregistration */ - void removedClient( OutputManager manager, DisconnectEvent event ) ; + void removedClient( OutputManager manager, DisconnectEvent event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/output/OutputMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -14,27 +14,24 @@ * limitations under the License. * */ -package org.apache.seda.output ; +package org.apache.seda.output; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.commons.lang.exception.ExceptionUtils ; +import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.seda.event.ConnectEvent ; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.DisconnectEvent ; -import org.apache.seda.listener.KeyExpiryException ; -import org.apache.seda.output.OutputMonitor; -import org.apache.seda.output.OutputManager; +import org.apache.seda.event.ConnectEvent; +import org.apache.seda.listener.ClientKey; +import org.apache.seda.event.DisconnectEvent; +import org.apache.seda.listener.KeyExpiryException; /** * A do nothing output monitor adapter. For safety's sake error conditions are * printed to the console. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class OutputMonitorAdapter implements OutputMonitor @@ -49,7 +46,7 @@ Throwable t ) { System.err.println( "Failed on write to client " + key + ":\n" - + ExceptionUtils.getFullStackTrace( t ) ) ; + + ExceptionUtils.getFullStackTrace( t ) ); } @@ -77,7 +74,7 @@ */ public void channelMissing( OutputManager manager, ClientKey key ) { - System.err.println( "Channel for client " + key + " missing." ) ; + System.err.println( "Channel for client " + key + " missing." ); } @@ -90,7 +87,7 @@ KeyExpiryException e ) { System.err.println( "Key for client " + key + ":\n" - + ExceptionUtils.getFullStackTrace( e ) ) ; + + ExceptionUtils.getFullStackTrace( e ) ); } @@ -103,7 +100,7 @@ Throwable fault ) { System.err.println( "Failed to inform of " + event + ":\n" - + ExceptionUtils.getFullStackTrace( fault ) ) ; + + ExceptionUtils.getFullStackTrace( fault ) ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/HandlerTypeEnum.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/HandlerTypeEnum.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/HandlerTypeEnum.java Sat Sep 11 17:31:18 2004 @@ -14,10 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; +package org.apache.seda.protocol; -import org.apache.commons.lang.enum.ValuedEnum ; +import org.apache.commons.lang.enum.ValuedEnum; /** @@ -31,21 +31,21 @@ public class HandlerTypeEnum extends ValuedEnum { /** Value for noreply enumeration type */ - public static final int NOREPLY_VAL = 0 ; + public static final int NOREPLY_VAL = 0; /** Value for singlereply enumeration type */ - public static final int SINGLEREPLY_VAL = 1 ; + public static final int SINGLEREPLY_VAL = 1; /** Value for manyreply enumeration type */ - public static final int MANYREPLY_VAL = 2 ; + public static final int MANYREPLY_VAL = 2; /** Enum for noreply type */ public static final HandlerTypeEnum NOREPLY = - new HandlerTypeEnum( "NOREPLY", NOREPLY_VAL ) ; + new HandlerTypeEnum( "NOREPLY", NOREPLY_VAL ); /** Enum for singlereply type */ public static final HandlerTypeEnum SINGLEREPLY = - new HandlerTypeEnum( "SINGLEREPLY", SINGLEREPLY_VAL ) ; + new HandlerTypeEnum( "SINGLEREPLY", SINGLEREPLY_VAL ); /** Enum for manyreply type */ public static final HandlerTypeEnum MANYREPLY = - new HandlerTypeEnum( "MANYREPLY", MANYREPLY_VAL ) ; + new HandlerTypeEnum( "MANYREPLY", MANYREPLY_VAL ); /** @@ -56,6 +56,6 @@ */ private HandlerTypeEnum( String name, int value ) { - super( name, value ) ; + super( name, value ); } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/NoReplyHandler.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/NoReplyHandler.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/NoReplyHandler.java Sat Sep 11 17:31:18 2004 @@ -14,15 +14,14 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; +package org.apache.seda.protocol; /** * Represents handlers that do not return a response to the client. * - * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a> - * @author $Author: akarasulu $ - * @version $Revision: 1.2 $ + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> + * @version $Rev$ */ public interface NoReplyHandler extends RequestHandler @@ -33,5 +32,5 @@ * * @param request the request without a response. */ - void handle( Object request ) ; + void handle( Object request ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestHandler.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestHandler.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestHandler.java Sat Sep 11 17:31:18 2004 @@ -14,16 +14,13 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; - -import org.apache.seda.protocol.HandlerTypeEnum; +package org.apache.seda.protocol; /** * Root of all request handler types. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface RequestHandler @@ -33,5 +30,5 @@ * * @return a HandlerTypeEnum constant. */ - HandlerTypeEnum getHandlerType() ; + HandlerTypeEnum getHandlerType(); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessor.java Sat Sep 11 17:31:18 2004 @@ -14,7 +14,7 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; +package org.apache.seda.protocol; /** Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,14 +14,13 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; +package org.apache.seda.protocol; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.seda.event.Subscriber ; +import org.apache.seda.event.Subscriber; import org.apache.seda.listener.ClientKey; -import org.apache.seda.listener.ClientKey ; /** @@ -41,13 +40,14 @@ * @param t the throwable that prevented delivery */ void failedOnInform( Subscriber subscriber, EventObject event, - Throwable t ) ; + Throwable t ); /** - * - * @param key - * @param request - * @param t + * Monitors failures while applying a single reply handler to a request. + * + * @param key the key of the client associated with the request + * @param request the request to process/handle + * @param t the failure that occurred while processing the request */ - void failedOnSingleReply( ClientKey key, Object request, Throwable t ) ; + void failedOnSingleReply( ClientKey key, Object request, Throwable t ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/RequestProcessorMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -14,28 +14,26 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; +package org.apache.seda.protocol; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.commons.lang.exception.ExceptionUtils ; +import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.seda.event.Subscriber ; -import org.apache.seda.listener.ClientKey ; +import org.apache.seda.event.Subscriber; +import org.apache.seda.listener.ClientKey; /** * A convenient adapter for request processors monitors. Exceptional conditions * are transformed into and reported as runtime exceptions. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class RequestProcessorMonitorAdapter implements RequestProcessorMonitor { - /* @see org.apache.seda.protocol.RequestProcessorMonitor#failedOnInform( * org.apache.seda.event.Subscriber, java.util.EventObject, * java.lang.Throwable) @@ -43,7 +41,10 @@ public void failedOnInform( Subscriber subscriber, EventObject event, Throwable t ) { - System.err.println( ExceptionUtils.getFullStackTrace( t ) ) ; + if ( t != null ) + { + t.printStackTrace(); + } } @@ -55,16 +56,9 @@ public void failedOnSingleReply( ClientKey key, Object request, Throwable t ) { - // @todo We should be able to email this or even post it to JIRA. - // if some of error reporting configuration parameters are set. Or - // perhaps this is something best left to a logger customization. - - StringBuffer buf = new StringBuffer() ; - buf.append( "Encountered an operational error while processing " ) ; - buf.append( request ) ; - buf.append( " request. Please report the the following server stack" ); - buf.append( " trace to the Apache Directory Project.\n" ) ; - System.err.println( buf.toString() ) ; - t.printStackTrace(); + if ( t != null ) + { + t.printStackTrace(); + } } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/SingleReplyHandler.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/SingleReplyHandler.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/SingleReplyHandler.java Sat Sep 11 17:31:18 2004 @@ -14,9 +14,7 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; - -import org.apache.seda.protocol.RequestHandler; +package org.apache.seda.protocol; /** @@ -26,8 +24,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ -public interface SingleReplyHandler - extends RequestHandler +public interface SingleReplyHandler extends RequestHandler { /** * Handles a request that generates a sole response by returning the @@ -36,5 +33,5 @@ * @param request the request to handle. * @return the response to the request argument. */ - Object handle( Object request ) ; + Object handle( Object request ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/TransportTypeEnum.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/TransportTypeEnum.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/protocol/TransportTypeEnum.java Sat Sep 11 17:31:18 2004 @@ -14,10 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.protocol ; +package org.apache.seda.protocol; -import org.apache.commons.lang.enum.ValuedEnum ; +import org.apache.commons.lang.enum.ValuedEnum; /** @@ -29,21 +29,21 @@ public class TransportTypeEnum extends ValuedEnum { /** Value for TCP transport enumeration type */ - public static final int TCP_VAL = 0 ; + public static final int TCP_VAL = 0; /** Value for UDP transport enumeration type */ - public static final int UDP_VAL = 1 ; + public static final int UDP_VAL = 1; /** Value for PIPE transport enumeration type */ - public static final int PIPE_VAL = 2 ; + public static final int PIPE_VAL = 2; /** Enum for TCP type */ public static final TransportTypeEnum TCP = - new TransportTypeEnum( "TCP", TCP_VAL ) ; + new TransportTypeEnum( "TCP", TCP_VAL ); /** Enum for UDP type */ public static final TransportTypeEnum UDP = - new TransportTypeEnum( "UDP", UDP_VAL ) ; + new TransportTypeEnum( "UDP", UDP_VAL ); /** Enum for PIPE type */ public static final TransportTypeEnum PIPE = - new TransportTypeEnum( "PIPE", PIPE_VAL ) ; + new TransportTypeEnum( "PIPE", PIPE_VAL ); /** @@ -54,6 +54,6 @@ */ private TransportTypeEnum( String name, int value ) { - super( name, value ) ; + super( name, value ); } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/session/ClientSession.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/session/ClientSession.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/session/ClientSession.java Sat Sep 11 17:31:18 2004 @@ -14,23 +14,21 @@ * limitations under the License. * */ -package org.apache.seda.session ; +package org.apache.seda.session; -import java.util.Locale ; -import java.util.Iterator ; +import java.util.Locale; +import java.util.Iterator; -import java.security.Principal ; +import java.security.Principal; -import org.apache.seda.listener.ClientKey ; import org.apache.seda.listener.ClientKey; /** * Session interface for a client. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface ClientSession @@ -40,7 +38,7 @@ * * @return the unique client key */ - ClientKey getClientKey() ; + ClientKey getClientKey(); /** * Gets whether or not this session is valid. A valid session is one that @@ -50,14 +48,14 @@ * * @return true if this session is still valid, false if it is not */ - boolean isValid() ; + boolean isValid(); /** * Gets an iterator over all the attribute names stored in this session. * * @return an iterator of key names */ - Iterator getAttributeNames() ; + Iterator getAttributeNames(); /** * Gets the value for a session attribute name. @@ -65,14 +63,14 @@ * @param an_attrName the name of the session attribute key * @return the value of the session attribute */ - Object getAttribute( String an_attrName ) ; + Object getAttribute( String an_attrName ); /** * Removes a session attribute key and value from this session. * * @param an_attrName the name of the session attribute key */ - void removeAttribute( String an_attrName ) ; + void removeAttribute( String an_attrName ); /** * Sets the value of a session attribute. @@ -80,7 +78,7 @@ * @param an_attrName the name of the session attribute key * @param a_attrValue the value to set for the session attribute */ - void setAttribute( String an_attrName, Object a_attrValue ) ; + void setAttribute( String an_attrName, Object a_attrValue ); /** * Determines if this session is newly created before an appropriate @@ -88,21 +86,21 @@ * * @return true if the principal has yet to be authenticated */ - boolean isNew() ; + boolean isNew(); /** * Gets the creation time of this session in milliseconds. * * @return the creation time in milliseconds */ - long getCreationTime() ; + long getCreationTime(); /** * Gets the time this session was accessed in milliseconds. * * @return the last access time in milliseconds */ - long getLastAccessedTime() ; + long getLastAccessedTime(); /** * Gets the maximum inactivity time in seconds before timing out this @@ -110,14 +108,14 @@ * * @return the timeout period in seconds */ - int getMaxInactiveInterval() ; + int getMaxInactiveInterval(); /** * Gets the locale of the session's client. * * @return the locale of the client */ - Locale getLocale() ; + Locale getLocale(); /** * Gets the principal for the client this session belongs to. If the @@ -126,5 +124,5 @@ * * @return the principal owning this session */ - Principal getPrincipal() ; + Principal getPrincipal(); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/DefaultStageConfig.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/DefaultStageConfig.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/DefaultStageConfig.java Sat Sep 11 17:31:18 2004 @@ -14,32 +14,31 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; -import java.util.List ; -import java.util.ArrayList ; +import java.util.List; +import java.util.ArrayList; -import org.apache.seda.thread.ThreadPool ; +import org.apache.seda.thread.ThreadPool; /** * The default bean implementation for a stage's configuration. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultStageConfig implements StageConfig { /** the name of this Stage */ - private final String name ; + private final String name; /** this Stage's handler */ - private StageHandler handler ; + private StageHandler handler; /** the enqueue predicates for this Stage */ - private final List predicates ; + private final List predicates; /** the thread pool used for this Stages workers */ - private final ThreadPool tp ; + private final ThreadPool tp; /** @@ -53,17 +52,17 @@ public DefaultStageConfig( String name, StageHandler handler, List predicates, ThreadPool tp ) { - this.tp = tp ; - this.name = name ; - this.handler = handler ; + this.tp = tp; + this.name = name; + this.handler = handler; if ( predicates == null ) { - this.predicates = new ArrayList() ; + this.predicates = new ArrayList(); } else { - this.predicates = predicates ; + this.predicates = predicates; } } @@ -77,7 +76,7 @@ */ public DefaultStageConfig( String name, List predicates, ThreadPool tp ) { - this( name, null, predicates, tp ) ; + this( name, null, predicates, tp ); } @@ -89,7 +88,7 @@ */ public DefaultStageConfig( String name, ThreadPool tp ) { - this( name, null, null, tp ) ; + this( name, null, null, tp ); } @@ -98,7 +97,7 @@ */ public String getName() { - return name ; + return name; } @@ -107,13 +106,13 @@ */ public StageHandler getHandler() { - return handler ; + return handler; } public void setHandler( StageHandler handler ) { - this.handler = handler ; + this.handler = handler; } @@ -122,7 +121,7 @@ */ public List getPredicates() { - return predicates ; + return predicates; } @@ -131,6 +130,6 @@ */ public ThreadPool getThreadPool() { - return tp ; + return tp; } } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/EnqueuePredicate.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/EnqueuePredicate.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/EnqueuePredicate.java Sat Sep 11 17:31:18 2004 @@ -14,17 +14,16 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; -import java.util.EventObject ; +import java.util.EventObject; /** * Predicate used to determine whether or not an event is enqueued onto a Stage. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface EnqueuePredicate @@ -35,5 +34,5 @@ * @param event the event to enqueue * @return true if an enqueue operation is allowed false if it is denied */ - public boolean accept( EventObject event ) ; + public boolean accept( EventObject event ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/Stage.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/Stage.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/Stage.java Sat Sep 11 17:31:18 2004 @@ -14,19 +14,18 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; import org.apache.seda.stage.EnqueuePredicate; -import java.util.EventObject ; +import java.util.EventObject; /** * Simple SEDA Stage interface. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface Stage @@ -36,14 +35,14 @@ * * @return this Stage's configuration bean */ - StageConfig getConfig() ; + StageConfig getConfig(); /** * Enqueues an event onto this stage. * * @param event the event to enqueue */ - void enqueue( EventObject event ) ; + void enqueue( EventObject event ); /** * Adds an EnqueuePredicate to control what events can and cannot be @@ -51,6 +50,6 @@ * * @param predicate the enqueue predecate to add */ - void addPredicate( EnqueuePredicate predicate ) ; + void addPredicate( EnqueuePredicate predicate ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageConfig.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageConfig.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageConfig.java Sat Sep 11 17:31:18 2004 @@ -14,20 +14,19 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; -import java.util.List ; +import java.util.List; -import org.apache.seda.thread.ThreadPool ; +import org.apache.seda.thread.ThreadPool; import org.apache.seda.thread.ThreadPool; /** * The configuration required for a stage. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface StageConfig @@ -37,14 +36,14 @@ * * @return the name of the stage */ - String getName() ; + String getName(); /** * Gets the Stage's handler. * * @return the Stage's handler */ - StageHandler getHandler() ; + StageHandler getHandler(); /** * Gets the set of enqueue predicates used by the Stage to throttle and @@ -52,12 +51,12 @@ * * @return the enqueue predicates used by the Stage */ - List getPredicates() ; + List getPredicates(); /** * Gets the Stage's thread pool. * * @return the thread pool used by the Stage */ - ThreadPool getThreadPool() ; + ThreadPool getThreadPool(); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageHandler.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageHandler.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageHandler.java Sat Sep 11 17:31:18 2004 @@ -24,12 +24,10 @@ /** * Thread safe Event handler used by Stages. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ -public interface StageHandler - extends EventListener +public interface StageHandler extends EventListener { /** * Handles an event for the Stage. Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitor.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitor.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,13 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; -import org.apache.seda.stage.EnqueuePredicate; -import org.apache.seda.stage.Stage; - -import java.util.EventObject ; +import java.util.EventObject; /** @@ -37,14 +34,14 @@ * * @param stage the stage reporting a missing handler */ - void handlerMissing( Stage stage ) ; + void handlerMissing( Stage stage ); /** * A has been made to gracefully stop the Stage. * * @param stage the Stage being stopped */ - void stopping( Stage stage ) ; + void stopping( Stage stage ); /** * A has been made to gracefully stop the Stage but we're waiting for some @@ -53,7 +50,7 @@ * @param stage the Stage being stopped * @param millis the time in milliseconds waiting for workers to complete */ - void stopping( Stage stage, long millis ) ; + void stopping( Stage stage, long millis ); /** * The stage driver thread was notified out of the wait state due to an @@ -61,7 +58,7 @@ * * @param stage the notified Stage */ - void notified( Stage stage ) ; + void notified( Stage stage ); /** * Notification of stage driver thread going into wait state due to an @@ -69,28 +66,28 @@ * * @param stage the waiting Stage */ - void waiting( Stage stage ) ; + void waiting( Stage stage ); /** * Monitors Stage has starts. * * @param stage the started Stage */ - void started( Stage stage ) ; + void started( Stage stage ); /** * Monitors Stage has stops. * * @param stage the stopped Stage */ - void stopped( Stage stage ) ; + void stopped( Stage stage ); /** * Monitors StageDriver starts. * * @param stage the Stage whose driver started */ - void startedDriver( Stage stage ) ; + void startedDriver( Stage stage ); /** * Monitor for successful enqueue operations on the stage. @@ -98,7 +95,7 @@ * @param stage the stage enqueued on * @param event the event enqueued */ - void enqueueOccurred( Stage stage, EventObject event ) ; + void enqueueOccurred( Stage stage, EventObject event ); /** * Monitor for failed enqueue operations on the stage. @@ -106,7 +103,7 @@ * @param stage the stage where enqueue failed * @param event the event enqueue failed on */ - void enqueueRejected( Stage stage, EventObject event ) ; + void enqueueRejected( Stage stage, EventObject event ); /** * Queue lock acquired to enqueue an event. @@ -114,14 +111,14 @@ * @param stage the Stage whose queue lock was acquired * @param event the event to be enqueued */ - void lockedQueue( Stage stage, EventObject event ) ; + void lockedQueue( Stage stage, EventObject event ); /** * Queue lock acquired by awoken Stage driver thread. * * @param stage the Stage whose queue lock was acquired */ - void lockedQueue( Stage stage ) ; + void lockedQueue( Stage stage ); /** * Monitor for dequeue operations. @@ -129,7 +126,7 @@ * @param stage the Stage dequeued * @param event the event that was dequeued */ - void eventDequeued( Stage stage, EventObject event ) ; + void eventDequeued( Stage stage, EventObject event ); /** * Monitor for successfully completing the handling of an event. @@ -137,7 +134,7 @@ * @param stage the Stage processing the event * @param event the event that was handled */ - void eventHandled( Stage stage, EventObject event ) ; + void eventHandled( Stage stage, EventObject event ); // ------------------------------------------------------------------------ // failure monitors @@ -149,7 +146,7 @@ * @param stage the stage that caused the failure * @param fault the faulting exception */ - void driverFailed( Stage stage, InterruptedException fault ) ; + void driverFailed( Stage stage, InterruptedException fault ); /** * Monitors handler failures. @@ -158,7 +155,7 @@ * @param event the event the handler failed on * @param fault the faulting exception */ - void handlerFailed( Stage stage, EventObject event, Throwable fault ) ; + void handlerFailed( Stage stage, EventObject event, Throwable fault ); /** * Monitors enqueue predicate additions. @@ -167,5 +164,5 @@ * @param predicate the enqueue predicate added to the stage */ void predicateAdded( Stage stage, - EnqueuePredicate predicate ) ; + EnqueuePredicate predicate ); } Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitorAdapter.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitorAdapter.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/stage/StageMonitorAdapter.java Sat Sep 11 17:31:18 2004 @@ -14,10 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; -import java.util.EventObject ; +import java.util.EventObject; /** Modified: incubator/directory/seda/trunk/api/src/java/org/apache/seda/thread/ThreadPool.java ============================================================================== --- incubator/directory/seda/trunk/api/src/java/org/apache/seda/thread/ThreadPool.java (original) +++ incubator/directory/seda/trunk/api/src/java/org/apache/seda/thread/ThreadPool.java Sat Sep 11 17:31:18 2004 @@ -14,14 +14,13 @@ * limitations under the License. * */ -package org.apache.seda.thread ; +package org.apache.seda.thread; /** * A pool of threads used by the server or its Stages. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public interface ThreadPool @@ -30,7 +29,7 @@ * Allocates Thread from pool to execute a runnable and releases it on * completion. * - * @param a_runnable the runnable to execute + * @param runnable the runnable to execute */ - void execute( Runnable a_runnable ) ; + void execute( Runnable runnable ); } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/DefaultFrontend.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/DefaultFrontend.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/DefaultFrontend.java Sat Sep 11 17:31:18 2004 @@ -14,9 +14,7 @@ * limitations under the License. * */ -package org.apache.eve ; - -import org.apache.seda.Frontend; +package org.apache.seda; /** @@ -25,8 +23,7 @@ * applications embedding the frontend and accessing it outside of the * container. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultFrontend implements Frontend Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/DefaultBufferPool.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/DefaultBufferPool.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/DefaultBufferPool.java Sat Sep 11 17:31:18 2004 @@ -14,43 +14,36 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; +package org.apache.seda.buffer; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import java.util.ArrayList ; +import java.util.ArrayList; -import org.apache.commons.lang.Validate ; -import org.apache.seda.ResourceException ; -import org.apache.seda.buffer.BufferPool; -import org.apache.seda.buffer.BufferPoolConfig; -import org.apache.seda.buffer.BufferPoolMonitor; +import org.apache.commons.lang.Validate; +import org.apache.seda.ResourceException; /** * The default BufferPool implementation. * - * @see <a - * href="http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=DIR-12"> - * JIRA Issue</a> - * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @see <a href="http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=DIR-12">JIRA Issue</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultBufferPool implements BufferPool { /** a configuration bean */ - private final BufferPoolConfig m_config ; + private final BufferPoolConfig config; /** list of all buffers */ - private final ArrayList m_allList ; + private final ArrayList allList; /** list of currently free buffers */ - private final ArrayList m_freeList ; + private final ArrayList freeList; /** list of currently in use buffers */ - private final ArrayList m_inUseList ; + private final ArrayList inUseList; /** the monitor for this DefaultBufferPool */ - private BufferPoolMonitor m_monitor = new BufferPoolMonitorAdapter() ; + private BufferPoolMonitor monitor = new BufferPoolMonitorAdapter(); /** @@ -60,18 +53,18 @@ */ public DefaultBufferPool( BufferPoolConfig config ) { - super() ; + super(); - m_config = config ; - m_freeList = new ArrayList( config.getMaximumSize() ) ; - m_inUseList = new ArrayList( config.getMaximumSize() ) ; - m_allList = new ArrayList( config.getMaximumSize() ) ; - - for( int ii = 0; ii < m_config.getInitialSize(); ii++ ) - { - BufferListPair l_list = new BufferListPair() ; - m_freeList.add( l_list ) ; - m_allList.add( l_list ) ; + this.config = config; + this.freeList = new ArrayList( config.getMaximumSize() ); + this.inUseList = new ArrayList( config.getMaximumSize() ); + this.allList = new ArrayList( config.getMaximumSize() ); + + for( int ii = 0; ii < this.config.getInitialSize(); ii++ ) + { + BufferListPair l_list = new BufferListPair(); + this.freeList.add( l_list ); + this.allList.add( l_list ); } } @@ -82,35 +75,35 @@ public synchronized ByteBuffer getBuffer( Object party ) throws ResourceException { - BufferListPair l_list = null ; + BufferListPair l_list = null; - if ( m_freeList.size() == 0 ) + if ( freeList.size() == 0 ) { - if ( m_config.getIncrement() <= m_config.getMaximumSize() ) + if ( config.getIncrement() <= config.getMaximumSize() ) { - for ( int ii = 0; ii < m_config.getIncrement(); ii++ ) + for ( int ii = 0; ii < config.getIncrement(); ii++ ) { - l_list = new BufferListPair() ; - m_freeList.add( l_list ) ; - m_allList.add( l_list ) ; + l_list = new BufferListPair(); + freeList.add( l_list ); + allList.add( l_list ); } } else { - m_monitor.resourceUnavailable( this, party ) ; - throw new ResourceException( "Free Buffers unavailable" ) ; + monitor.resourceUnavailable( this, party ); + throw new ResourceException( "Free Buffers unavailable" ); } } // remove from free list and add to in use list then report to monitir - l_list = ( BufferListPair ) m_freeList.remove( 0 ) ; - m_inUseList.add( l_list ) ; - m_monitor.bufferTaken( this, l_list.getBuffer(), party ) ; + l_list = ( BufferListPair ) freeList.remove( 0 ); + inUseList.add( l_list ); + monitor.bufferTaken( this, l_list.getBuffer(), party ); // claim interest on the buffer automatically then report to monitor - l_list.add( party ) ; - m_monitor.interestClaimed( this, l_list.getBuffer(), party ) ; - return l_list.getBuffer() ; + l_list.add( party ); + monitor.interestClaimed( this, l_list.getBuffer(), party ); + return l_list.getBuffer(); } @@ -121,16 +114,16 @@ public synchronized void claimInterest( ByteBuffer buffer, Object party ) { - BufferListPair l_list = getBufferListPair( buffer ) ; + BufferListPair l_list = getBufferListPair( buffer ); if ( null == l_list ) { - m_monitor.nonPooledBuffer( this, buffer, party ) ; - throw new IllegalStateException( "Not a BufferPool resource" ) ; + monitor.nonPooledBuffer( this, buffer, party ); + throw new IllegalStateException( "Not a BufferPool resource" ); } - l_list.add( party ) ; - m_monitor.interestClaimed( this, buffer, party ) ; + l_list.add( party ); + monitor.interestClaimed( this, buffer, party ); } @@ -140,30 +133,30 @@ */ public synchronized void releaseClaim( ByteBuffer buffer, Object party ) { - BufferListPair l_list = getBufferListPair( buffer ) ; + BufferListPair l_list = getBufferListPair( buffer ); if ( null == l_list ) { - m_monitor.releaseOfUnclaimed( this, buffer, party ) ; - throw new IllegalArgumentException( "Not a pooled resource" ) ; + monitor.releaseOfUnclaimed( this, buffer, party ); + throw new IllegalArgumentException( "Not a pooled resource" ); } if ( ! l_list.contains( party ) ) { - m_monitor.unregisteredParty( this, buffer, party ) ; + monitor.unregisteredParty( this, buffer, party ); throw new IllegalStateException( - "Party nsedar registered interest with buffer" ) ; + "Party nsedar registered interest with buffer" ); } - l_list.remove( party ) ; - m_monitor.interestReleased( this, buffer, party ) ; + l_list.remove( party ); + monitor.interestReleased( this, buffer, party ); // if the list of interested parties hits zero then we release buf if ( l_list.size() == 0 ) { - m_inUseList.remove( l_list ) ; - m_freeList.add( l_list ) ; - m_monitor.bufferReleased( this, buffer, party ) ; + inUseList.remove( l_list ); + freeList.add( l_list ); + monitor.bufferReleased( this, buffer, party ); } } @@ -174,7 +167,7 @@ */ public BufferPoolConfig getConfig() { - return m_config ; + return config; } @@ -183,7 +176,7 @@ */ public synchronized int size() { - return m_allList.size() ; + return allList.size(); } @@ -192,7 +185,7 @@ */ public String getName() { - return m_config.getName() ; + return config.getName(); } @@ -201,7 +194,7 @@ */ public synchronized int getFreeCount() { - return m_freeList.size() ; + return freeList.size(); } @@ -210,7 +203,7 @@ */ public synchronized int getInUseCount() { - return m_inUseList.size() ; + return inUseList.size(); } @@ -220,9 +213,9 @@ */ public int getInterestedCount( ByteBuffer buffer ) { - BufferListPair l_list = getBufferListPair( buffer ) ; - Validate.notNull( l_list ) ; - return l_list.size() ; + BufferListPair l_list = getBufferListPair( buffer ); + Validate.notNull( l_list ); + return l_list.size(); } @@ -233,7 +226,7 @@ */ public BufferPoolMonitor getMonitor() { - return m_monitor ; + return monitor; } @@ -244,7 +237,7 @@ */ public void setMonitor( BufferPoolMonitor monitor ) { - m_monitor = monitor ; + this.monitor = monitor; } @@ -254,9 +247,9 @@ */ public String toString() { - StringBuffer l_buf = new StringBuffer( m_config.getName() ) ; - l_buf.append( " buffer pool" ) ; - return l_buf.toString() ; + StringBuffer l_buf = new StringBuffer( config.getName() ); + l_buf.append( " buffer pool" ); + return l_buf.toString(); } @@ -274,18 +267,18 @@ */ BufferListPair getBufferListPair( ByteBuffer buffer ) { - BufferListPair l_list = null ; + BufferListPair l_list = null; - for ( int ii = 0; ii < m_allList.size(); ii++ ) + for ( int ii = 0; ii < allList.size(); ii++ ) { - l_list = ( BufferListPair ) m_allList.get( ii ) ; + l_list = ( BufferListPair ) allList.get( ii ); if ( buffer == l_list.getBuffer() ) { - return l_list ; + return l_list; } } - return null ; + return null; } @@ -295,63 +288,63 @@ */ class BufferListPair { - final ArrayList m_list ; - final ByteBuffer m_buffer ; + final ArrayList list; + final ByteBuffer buffer; BufferListPair() { this( new ArrayList( 3 ), - ByteBuffer.allocateDirect( m_config.getBufferSize() ) ) ; + ByteBuffer.allocateDirect( config.getBufferSize() ) ); } BufferListPair( ByteBuffer buffer ) { - this( new ArrayList( 3 ), buffer ) ; + this( new ArrayList( 3 ), buffer ); } BufferListPair( ArrayList list, ByteBuffer buffer ) { - m_list = list ; - m_buffer = buffer ; + this.list = list; + this.buffer = buffer; } ByteBuffer getBuffer() { - return m_buffer ; + return buffer; } ArrayList getList() { - return m_list ; + return list; } void add( Object party ) { - m_list.add( party ) ; + list.add( party ); } boolean contains( Object party ) { - return m_list.contains( party ) ; + return list.contains( party ); } boolean remove( Object party ) { - return m_list.remove( party ) ; + return list.remove( party ); } int size() { - return m_list.size() ; + return list.size(); } } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/LoggingBufferMonitor.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/LoggingBufferMonitor.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/LoggingBufferMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,30 +14,27 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; +package org.apache.seda.buffer; -import java.nio.ByteBuffer ; +import java.nio.ByteBuffer; -import org.apache.commons.logging.Log ; -import org.apache.commons.logging.LogFactory ; -import org.apache.seda.buffer.BufferPool; -import org.apache.seda.buffer.BufferPoolMonitor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * Logging monitor for a BufferPool. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class LoggingBufferMonitor implements BufferPoolMonitor { /** the default name for the logging channel */ - private final String DEFAULT = "BufferPool" ; + private final String DEFAULT = "BufferPool"; /** the log - can be any implementation */ - private final Log log ; + private final Log log; /** @@ -45,7 +42,7 @@ */ public LoggingBufferMonitor() { - log = LogFactory.getLog( DEFAULT ) ; + log = LogFactory.getLog( DEFAULT ); } @@ -56,7 +53,7 @@ */ public LoggingBufferMonitor( String name ) { - log = LogFactory.getLog( name ) ; + log = LogFactory.getLog( name ); } @@ -68,7 +65,7 @@ { if ( log.isDebugEnabled() ) { - log.debug( "Just augmented the buffer pool" ) ; + log.debug( "Just augmented the buffer pool" ); } } @@ -83,7 +80,7 @@ if ( log.isDebugEnabled() ) { log.debug( releaser + " released " + buffer - + " from pool " + bp ) ; + + " from pool " + bp ); } } @@ -97,7 +94,7 @@ { if ( log.isDebugEnabled() ) { - log.debug( taker + " took " + buffer + " from pool " + bp ) ; + log.debug( taker + " took " + buffer + " from pool " + bp ); } } @@ -112,7 +109,7 @@ if ( log.isDebugEnabled() ) { log.debug( claimer + " claimed interest in " + buffer - + " from pool " + bp ) ; + + " from pool " + bp ); } } @@ -127,7 +124,7 @@ if ( log.isDebugEnabled() ) { log.debug( releaser + " released interest in " + buffer - + " from pool " + bp ) ; + + " from pool " + bp ); } } @@ -143,7 +140,7 @@ { log.error( party + " tried to release interest in " + buffer + " from pool " + bp - + " but resouce was not from this pool.") ; + + " but resouce was not from this pool."); } } @@ -158,7 +155,7 @@ { log.error( "BufferPool " + bp + " is at capacity - cannot allocate buffer resouce to " - + party ) ; + + party ); } } @@ -174,7 +171,7 @@ { log.debug( party + " has not registered as claiming interest on " + buffer - + " from pool " + bp ) ; + + " from pool " + bp ); } } @@ -190,7 +187,7 @@ { log.debug( releaser + " attempted to release interest in " + buffer + " from pool " - + bp + " when the buffer was not claimed." ) ; + + bp + " when the buffer was not claimed." ); } } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecodeStageHandler.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecodeStageHandler.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecodeStageHandler.java Sat Sep 11 17:31:18 2004 @@ -14,32 +14,31 @@ * limitations under the License. * */ -package org.apache.seda.decoder ; +package org.apache.seda.decoder; -import java.nio.ByteBuffer ; -import java.util.EventObject ; +import java.nio.ByteBuffer; +import java.util.EventObject; -import org.apache.commons.codec.DecoderException ; -import org.apache.commons.codec.stateful.StatefulDecoder ; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.stateful.StatefulDecoder; -import org.apache.seda.event.InputEvent ; -import org.apache.seda.stage.StageHandler ; -import org.apache.seda.listener.ClientKey ; +import org.apache.seda.event.InputEvent; +import org.apache.seda.stage.StageHandler; +import org.apache.seda.listener.ClientKey; /** * A decoder manager's decodeNonBlocking StageHandler for use only with enqueued * InputEvents. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DecodeStageHandler implements StageHandler { /** reference to the decoder manager this handler is used by */ - private final DefaultDecoderManager manager ; + private final DefaultDecoderManager manager; /** @@ -49,7 +48,7 @@ */ public DecodeStageHandler( DefaultDecoderManager manager ) { - this.manager = manager ; + this.manager = manager; } @@ -62,14 +61,14 @@ */ public void handleEvent( EventObject event ) { - InputEvent e = ( InputEvent ) event ; - ClientKey key = e.getClientKey() ; - ByteBuffer buf = e.claimInterest( this ) ; + InputEvent e = ( InputEvent ) event; + ClientKey key = e.getClientKey(); + ByteBuffer buf = e.claimInterest( this ); StatefulDecoder decoder = ( StatefulDecoder ) manager.getDecoder( key ); try { - decoder.decode( buf ) ; + decoder.decode( buf ); } catch( DecoderException ex ) { @@ -79,7 +78,7 @@ */ } - e.releaseInterest( this ) ; - e.releaseInterest( manager ) ; + e.releaseInterest( this ); + e.releaseInterest( manager ); } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/DefaultEncoderManager.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/DefaultEncoderManager.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/DefaultEncoderManager.java Sat Sep 11 17:31:18 2004 @@ -42,8 +42,7 @@ * shot encode module but this will change as well build stateful encoders which * will fragment a response into multiple output events. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultEncoderManager extends DefaultStage Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/AbstractSubscriber.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/AbstractSubscriber.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/AbstractSubscriber.java Sat Sep 11 17:31:18 2004 @@ -14,20 +14,18 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.util.List ; -import java.util.HashMap ; -import java.util.EventObject ; +import java.util.List; +import java.util.HashMap; +import java.util.EventObject; -import java.lang.reflect.Method ; -import java.lang.reflect.InvocationTargetException ; +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; -import org.apache.commons.lang.Validate ; -import org.apache.commons.lang.ClassUtils ; -import org.apache.seda.event.Subscriber; -import org.apache.seda.event.SubscriberMonitor; +import org.apache.commons.lang.Validate; +import org.apache.commons.lang.ClassUtils; /** @@ -36,17 +34,16 @@ * event. Reflection is used by the abstract subscriber's inform method to * determine at run time which inform method of a concrete subscriber to invoke. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class AbstractSubscriber implements Subscriber { /** cached inform methods for subscribers */ - private static final HashMap methods = new HashMap() ; + private static final HashMap methods = new HashMap(); /** monitor for this Subscriber */ - private final SubscriberMonitor monitor ; + private final SubscriberMonitor monitor; /** @@ -54,7 +51,7 @@ */ public AbstractSubscriber() { - monitor = null ; + monitor = null; } @@ -65,7 +62,7 @@ */ public AbstractSubscriber( SubscriberMonitor monitor ) { - this.monitor = monitor ; + this.monitor = monitor; } @@ -76,20 +73,20 @@ { try { - inform( this, event ) ; + inform( this, event ); } catch ( Throwable t ) { if ( monitor != null ) { - monitor.failedOnInform( this, event, t ) ; + monitor.failedOnInform( this, event, t ); } else { System.err.println( "Failed to inform this Subscriber " + - this + " about event " + event ) ; + this + " about event " + event ); System.err.println( "To prevent the above println use a non " - + "null SubscriberMonitor" ) ; + + "null SubscriberMonitor" ); } } } @@ -109,12 +106,12 @@ public static void inform( Subscriber subscriber, EventObject event ) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { - Validate.notNull( subscriber, "subscriber arg cannot be null" ) ; - Validate.notNull( event, "event arg cannot be null" ) ; + Validate.notNull( subscriber, "subscriber arg cannot be null" ); + Validate.notNull( event, "event arg cannot be null" ); - Method method = getSpecificInformMethod( subscriber, event ) ; - Object params[] = { event } ; - method.invoke( subscriber, params ) ; + Method method = getSpecificInformMethod( subscriber, event ); + Object params[] = { event }; + method.invoke( subscriber, params ); } @@ -132,47 +129,47 @@ EventObject event ) throws NoSuchMethodException { - Method method = null ; + Method method = null; /* * attempt a lookup into the signature cache to see if we can find * the method there if not then we need to search for the method */ - StringBuffer signature = new StringBuffer() ; - signature.append( subscr.getClass().getName() ) ; - signature.append( '.' ) ; - signature.append( "inform(" ) ; - signature.append( event.getClass().getName() ) ; - signature.append( ')' ) ; + StringBuffer signature = new StringBuffer(); + signature.append( subscr.getClass().getName() ); + signature.append( '.' ); + signature.append( "inform(" ); + signature.append( event.getClass().getName() ); + signature.append( ')' ); - String key = signature.toString() ; + String key = signature.toString(); if ( methods.containsKey( key ) ) { - return ( Method ) methods.get( key ) ; + return ( Method ) methods.get( key ); } /* * we could not find the method in the cache so we need to find it * and add it to the cache if it exists at all */ - List list = ClassUtils.getAllSuperclasses( event.getClass() ) ; - list.removeAll( ClassUtils.getAllSuperclasses( EventObject.class ) ) ; - list.add( 0, event.getClass() ) ; + List list = ClassUtils.getAllSuperclasses( event.getClass() ); + list.removeAll( ClassUtils.getAllSuperclasses( EventObject.class ) ); + list.add( 0, event.getClass() ); // there may be two EventObject class references in the list while( list.contains( EventObject.class ) ) { - list.remove( EventObject.class ) ; + list.remove( EventObject.class ); } - Method[] all = subscr.getClass().getMethods() ; + Method[] all = subscr.getClass().getMethods(); for ( int ii = 0; ii < all.length; ii++ ) { - method = all[ii] ; + method = all[ii]; if ( method.getName().equals( "inform" ) ) { - Class[] paramTypes = method.getParameterTypes() ; + Class[] paramTypes = method.getParameterTypes(); if ( paramTypes.length == 1 ) { @@ -180,8 +177,8 @@ { if ( paramTypes[0] == list.get( jj ) ) { - methods.put( key, method ) ; - return method ; + methods.put( key, method ); + return method; } } } @@ -190,6 +187,6 @@ throw new NoSuchMethodException( "Could not find a more specific " + "inform method other than " + subscr.getClass().getName() - + ".inform(EventObject)" ) ; + + ".inform(EventObject)" ); } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/DefaultEventRouter.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/DefaultEventRouter.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/DefaultEventRouter.java Sat Sep 11 17:31:18 2004 @@ -14,30 +14,27 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import org.apache.seda.event.*; - -import java.util.Set ; -import java.util.HashSet ; -import java.util.Iterator ; -import java.util.EventObject ; +import java.util.Set; +import java.util.HashSet; +import java.util.Iterator; +import java.util.EventObject; /** * An synchronous implementation of the event router / notification pattern. * - * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a> - * @author $Author: akarasulu $ - * @version $Rev: 1452 $ + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> + * @version $Rev$ */ public class DefaultEventRouter implements EventRouter { /** the set of subscriptions made with this router */ - private Set m_subscriptions = new HashSet() ; + private Set subscriptions = new HashSet(); /** the monitor - initially set to the null monitor */ - private EventRouterMonitor m_monitor = new EventRouterMonitorAdapter() ; + private EventRouterMonitor monitor = new EventRouterMonitorAdapter(); /* (non-Javadoc) @@ -46,7 +43,7 @@ */ public void subscribe( Class type, Subscriber subscriber ) { - subscribe( type, null, subscriber ) ; + subscribe( type, null, subscriber ); } @@ -59,20 +56,20 @@ if ( ! EventObject.class.isAssignableFrom( type ) ) { throw new IllegalArgumentException( "Invalid event class: " - + type.getName() ) ; + + type.getName() ); } Subscription l_subscription = - new Subscription( type, filter, subscriber ) ; + new Subscription( type, filter, subscriber ); - if ( ! m_subscriptions.contains( l_subscription ) ) + if ( ! subscriptions.contains( l_subscription ) ) { - synchronized ( m_subscriptions ) + synchronized ( subscriptions ) { - m_subscriptions.add( l_subscription ) ; + subscriptions.add( l_subscription ); } - m_monitor.addedSubscription( l_subscription ) ; + monitor.addedSubscription( l_subscription ); } } @@ -83,17 +80,17 @@ */ public void unsubscribe( Subscriber subscriber ) { - Iterator l_list = m_subscriptions.iterator() ; + Iterator l_list = subscriptions.iterator(); - synchronized ( m_subscriptions ) + synchronized ( subscriptions ) { while ( l_list.hasNext() ) { - Subscription l_subscription = ( Subscription ) l_list.next() ; + Subscription l_subscription = ( Subscription ) l_list.next(); if ( subscriber == l_subscription.getSubscriber() ) { - l_list.remove() ; - m_monitor.removedSubscription( l_subscription ) ; + l_list.remove(); + monitor.removedSubscription( l_subscription ); } } } @@ -107,18 +104,18 @@ */ public void unsubscribe( Class type, Subscriber subscriber ) { - Iterator l_list = m_subscriptions.iterator() ; + Iterator l_list = subscriptions.iterator(); - synchronized ( m_subscriptions ) + synchronized ( subscriptions ) { while ( l_list.hasNext() ) { - Subscription l_subscription = ( Subscription ) l_list.next() ; + Subscription l_subscription = ( Subscription ) l_list.next(); if ( subscriber == l_subscription.getSubscriber() && type.equals( l_subscription.getType() ) ) { - l_list.remove() ; - m_monitor.removedSubscription( l_subscription ) ; + l_list.remove(); + monitor.removedSubscription( l_subscription ); } } } @@ -136,15 +133,15 @@ if ( ! EventObject.class.isAssignableFrom( type ) ) { throw new IllegalArgumentException( "Invalid event class: " - + type.getName() ) ; + + type.getName() ); } final Subscription l_subscription = new Subscription( type, filter, - subscriber ) ; + subscriber ); - synchronized ( m_subscriptions ) + synchronized ( subscriptions ) { - m_subscriptions.remove( l_subscription ) ; + subscriptions.remove( l_subscription ); } } @@ -155,31 +152,31 @@ */ public void publish( EventObject event ) { - final Subscription [] l_subscriptions ; + final Subscription [] l_subscriptions; - synchronized ( m_subscriptions ) + synchronized ( subscriptions ) { - l_subscriptions = ( Subscription [] ) m_subscriptions - .toArray( new Subscription [ m_subscriptions.size() ] ) ; + l_subscriptions = ( Subscription [] ) subscriptions + .toArray( new Subscription [ subscriptions.size() ] ); } for ( int ii = 0; ii < l_subscriptions.length; ii++ ) { boolean isAssignable = l_subscriptions[ii].getType() - .isAssignableFrom( event.getClass() ) ; + .isAssignableFrom( event.getClass() ); if ( ! isAssignable ) { - continue ; + continue; } if ( l_subscriptions[ii].getFilter() == null ) { - l_subscriptions[ii].getSubscriber().inform( event ) ; + l_subscriptions[ii].getSubscriber().inform( event ); } else if ( l_subscriptions[ii].getFilter().accept( event ) ) { - l_subscriptions[ii].getSubscriber().inform( event ) ; + l_subscriptions[ii].getSubscriber().inform( event ); } } } @@ -192,7 +189,7 @@ */ public void setMonitor( EventRouterMonitor monitor ) { - m_monitor = monitor ; + this.monitor = monitor; } @@ -203,6 +200,6 @@ */ public EventRouterMonitor getMonitor() { - return m_monitor ; + return monitor; } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/DefaultInputManager.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/DefaultInputManager.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/DefaultInputManager.java Sat Sep 11 17:31:18 2004 @@ -14,59 +14,56 @@ * limitations under the License. * */ -package org.apache.seda.input ; +package org.apache.seda.input; -import java.util.Iterator ; -import java.util.ArrayList ; +import java.util.Iterator; +import java.util.ArrayList; -import java.io.IOException ; -import java.nio.ByteBuffer ; -import java.nio.channels.Selector ; -import java.nio.channels.SelectionKey ; -import java.nio.channels.SocketChannel ; - -import org.apache.seda.event.InputEvent ; -import org.apache.seda.ResourceException ; -import org.apache.seda.input.InputManagerMonitor; -import org.apache.seda.input.InputManager; -import org.apache.seda.buffer.BufferPool ; -import org.apache.seda.event.EventRouter ; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ConnectEvent ; -import org.apache.seda.event.DisconnectEvent ; -import org.apache.seda.event.ConnectSubscriber ; -import org.apache.seda.event.DisconnectSubscriber ; -import org.apache.seda.listener.KeyExpiryException ; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.Selector; +import java.nio.channels.SelectionKey; +import java.nio.channels.SocketChannel; + +import org.apache.seda.event.InputEvent; +import org.apache.seda.ResourceException; +import org.apache.seda.buffer.BufferPool; +import org.apache.seda.event.EventRouter; +import org.apache.seda.listener.ClientKey; +import org.apache.seda.event.ConnectEvent; +import org.apache.seda.event.DisconnectEvent; +import org.apache.seda.event.ConnectSubscriber; import org.apache.seda.event.AbstractSubscriber; +import org.apache.seda.event.DisconnectSubscriber; +import org.apache.seda.listener.KeyExpiryException; /** * Default InputManager implementation based on NIO selectors and channels. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev: 1452 $ */ public class DefaultInputManager extends AbstractSubscriber implements InputManager, ConnectSubscriber, DisconnectSubscriber, Runnable { /** the thread driving this Runnable */ - private Thread m_thread = null ; + private Thread thread = null; /** parameter used to politely stop running thread */ - private Boolean m_hasStarted = null ; + private Boolean hasStarted = null; /** the buffer pool we get direct buffers from */ - private BufferPool m_bp = null ; + private BufferPool bp = null; /** event router used to decouple source to sink relationships */ - private EventRouter m_router = null ; + private EventRouter router = null; /** selector used to select a ready socket channel */ - private Selector m_selector = null ; + private Selector selector = null; /** contains the batch of new connect events and channels to register */ - private final ArrayList m_connectEvents = new ArrayList() ; + private final ArrayList connectEvents = new ArrayList(); /** contains the batch of disconnect events & selection keys to cancel */ - private final ArrayList m_disconnectEvents = new ArrayList() ; + private final ArrayList disconnectEvents = new ArrayList(); /** the input manager's monitor */ - private InputManagerMonitor m_monitor = new InputManagerMonitorAdapter() ; + private InputManagerMonitor monitor = new InputManagerMonitorAdapter(); // ------------------------------------------------------------------------ @@ -83,13 +80,13 @@ public DefaultInputManager( EventRouter router, BufferPool bp ) throws IOException { - m_bp = bp ; - m_hasStarted = new Boolean( false ) ; - m_selector = Selector.open() ; - - m_router = router ; - m_router.subscribe( ConnectEvent.class, null, this ) ; - m_router.subscribe( DisconnectEvent.class, null, this ) ; + this.bp = bp; + hasStarted = new Boolean( false ); + selector = Selector.open(); + + this.router = router; + this.router.subscribe( ConnectEvent.class, null, this ); + this.router.subscribe( DisconnectEvent.class, null, this ); } @@ -114,7 +111,7 @@ * * http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=DIR-18 */ - while ( m_hasStarted.booleanValue() ) + while ( hasStarted.booleanValue() ) { try { @@ -122,11 +119,11 @@ * Register newly arrived connections and unregister thosed * that were dropped while we were blocked on the select call */ - registerNewConnections() ; - unregisterDroppedConnections() ; + registerNewConnections(); + unregisterDroppedConnections(); // report that we're about to enter the select call - m_monitor.enteringSelect( m_selector ) ; + monitor.enteringSelect( selector ); /* * Clean stale connections that do not have and data: select @@ -135,34 +132,34 @@ * connections lingering around. We remove them since they * are prematurely triggering selection to return w/o input. */ - if ( 0 == m_selector.select() ) + if ( 0 == selector.select() ) { - Iterator l_list = m_selector.selectedKeys().iterator() ; + Iterator l_list = selector.selectedKeys().iterator(); while( l_list.hasNext() ) { - SelectionKey l_key = ( SelectionKey ) l_list.next() ; - l_key.channel().close() ; - l_key.cancel() ; - l_list.remove() ; + SelectionKey l_key = ( SelectionKey ) l_list.next(); + l_key.channel().close(); + l_key.cancel(); + l_list.remove(); - m_monitor.cleanedStaleKey( l_key ) ; + monitor.cleanedStaleKey( l_key ); } - m_monitor.selectTimedOut( m_selector ) ; - continue ; + monitor.selectTimedOut( selector ); + continue; } } catch( IOException e ) { - m_monitor.selectFailure( m_selector, e ) ; - continue ; + monitor.selectFailure( selector, e ); + continue; } /* * At this point we've come out of the select call with valid * input on channels and need to process that input. */ - processInput() ; + processInput(); } } @@ -172,16 +169,16 @@ */ public void start() { - synchronized( m_hasStarted ) + synchronized( hasStarted ) { - if ( m_hasStarted.booleanValue() ) + if ( hasStarted.booleanValue() ) { - throw new IllegalStateException( "Already started!" ) ; + throw new IllegalStateException( "Already started!" ); } - m_hasStarted = new Boolean( true ) ; - m_thread = new Thread( this ) ; - m_thread.start() ; + hasStarted = new Boolean( true ); + thread = new Thread( this ); + thread.start(); } } @@ -191,14 +188,14 @@ */ public void stop() throws InterruptedException { - synchronized( m_hasStarted ) + synchronized( hasStarted ) { - m_hasStarted = new Boolean( false ) ; - m_selector.wakeup() ; + hasStarted = new Boolean( false ); + selector.wakeup(); - while ( m_thread.isAlive() ) + while ( thread.isAlive() ) { - Thread.sleep( 100 ) ; + Thread.sleep( 100 ); } } } @@ -214,12 +211,12 @@ */ public void inform( ConnectEvent an_event ) { - synchronized ( m_connectEvents ) + synchronized ( connectEvents ) { - m_connectEvents.add( an_event ) ; + connectEvents.add( an_event ); } - m_selector.wakeup() ; + selector.wakeup(); } @@ -228,12 +225,12 @@ */ public void inform( DisconnectEvent an_event ) { - synchronized ( m_disconnectEvents ) + synchronized ( disconnectEvents ) { - m_disconnectEvents.add( an_event ) ; + disconnectEvents.add( an_event ); } - m_selector.wakeup() ; + selector.wakeup(); } @@ -248,44 +245,44 @@ private void registerNewConnections() { // copy of newly arrived events batched in the list of ConnectEvents - ConnectEvent[] l_events = null ; - synchronized( m_connectEvents ) + ConnectEvent[] l_events = null; + synchronized( connectEvents ) { - l_events = new ConnectEvent[m_connectEvents.size()] ; + l_events = new ConnectEvent[connectEvents.size()]; l_events = ( ConnectEvent[] ) - m_connectEvents.toArray( l_events ) ; - m_connectEvents.clear() ; + connectEvents.toArray( l_events ); + connectEvents.clear(); } // cycle through connections and register them with the selector - for ( int ii = 0; ii < l_events.length ; ii++ ) + for ( int ii = 0; ii < l_events.length; ii++ ) { - ClientKey l_key = null ; - SocketChannel l_channel = null ; + ClientKey l_key = null; + SocketChannel l_channel = null; try { - l_key = l_events[ii].getClientKey() ; - l_channel = l_key.getSocket().getChannel() ; + l_key = l_events[ii].getClientKey(); + l_channel = l_key.getSocket().getChannel(); // hands-off blocking sockets! if ( null == l_channel ) { - continue ; + continue; } - l_channel.configureBlocking( false ) ; - l_channel.register( m_selector, SelectionKey.OP_READ, l_key ) ; - m_monitor.registeredChannel( l_key, m_selector ) ; + l_channel.configureBlocking( false ); + l_channel.register( selector, SelectionKey.OP_READ, l_key ); + monitor.registeredChannel( l_key, selector ); } catch ( KeyExpiryException e ) { - m_monitor.keyExpiryFailure( l_key, e ) ; + monitor.keyExpiryFailure( l_key, e ); } catch ( IOException e ) { - m_monitor.channelRegistrationFailure( m_selector, l_channel, - SelectionKey.OP_READ, e ) ; + monitor.channelRegistrationFailure( selector, l_channel, + SelectionKey.OP_READ, e ); } } } @@ -300,50 +297,50 @@ */ private void unregisterDroppedConnections() { - SelectionKey l_key = null ; - DisconnectEvent[] l_events = null ; + SelectionKey l_key = null; + DisconnectEvent[] l_events = null; // synchronized copy all events into a separate list first and clear - synchronized( m_disconnectEvents ) + synchronized( disconnectEvents ) { - l_events = new DisconnectEvent[m_disconnectEvents.size()] ; + l_events = new DisconnectEvent[disconnectEvents.size()]; l_events = ( DisconnectEvent[] ) - m_disconnectEvents.toArray( l_events ) ; - m_disconnectEvents.clear() ; + disconnectEvents.toArray( l_events ); + disconnectEvents.clear(); } // cancel selection key for the disconnect event's client for ( int ii = 0; ii < l_events.length; ii++ ) { - Iterator l_keys = m_selector.keys().iterator() ; - ClientKey l_clientKey = l_events[ii].getClientKey() ; + Iterator l_keys = selector.keys().iterator(); + ClientKey l_clientKey = l_events[ii].getClientKey(); while ( l_keys.hasNext() ) { - l_key = ( SelectionKey ) l_keys.next() ; + l_key = ( SelectionKey ) l_keys.next(); if ( l_key.attachment().equals( l_clientKey ) ) { - break ; + break; } } if ( null == l_key ) { - return ; + return; } try { - l_key.channel().close() ; + l_key.channel().close(); } catch ( IOException e ) { - m_monitor.channelCloseFailure( - ( SocketChannel ) l_key.channel(), e ) ; + monitor.channelCloseFailure( + ( SocketChannel ) l_key.channel(), e ); } - l_key.cancel() ; - m_monitor.disconnectedClient( l_clientKey ) ; + l_key.cancel(); + monitor.disconnectedClient( l_clientKey ); } } @@ -359,16 +356,16 @@ * pool. Next we create an InputEvent using the buffer and publish * it using the event notifier/router. */ - Iterator l_list = m_selector.selectedKeys().iterator() ; + Iterator l_list = selector.selectedKeys().iterator(); while ( l_list.hasNext() ) { - SelectionKey l_key = ( SelectionKey ) l_list.next() ; - ClientKey l_client = ( ClientKey ) l_key.attachment() ; + SelectionKey l_key = ( SelectionKey ) l_list.next(); + ClientKey l_client = ( ClientKey ) l_key.attachment(); if ( l_key.isReadable() ) { - ByteBuffer l_buf = null ; - SocketChannel l_channel = ( SocketChannel ) l_key.channel() ; + ByteBuffer l_buf = null; + SocketChannel l_channel = ( SocketChannel ) l_key.channel(); /* * claim a buffer, read from channel into it and remove @@ -376,31 +373,31 @@ */ try { - l_buf = m_bp.getBuffer( this ) ; + l_buf = bp.getBuffer( this ); if ( l_channel.read( l_buf ) == -1 ) { - l_channel.socket().close() ; - l_channel.close() ; - l_key.cancel() ; - return ; + l_channel.socket().close(); + l_channel.close(); + l_key.cancel(); + return; } - l_buf.flip() ; - m_monitor.inputRecieved( - l_buf.asReadOnlyBuffer(), l_client ) ; - l_list.remove() ; + l_buf.flip(); + monitor.inputRecieved( + l_buf.asReadOnlyBuffer(), l_client ); + l_list.remove(); } catch ( ResourceException e ) { - m_monitor.bufferUnavailable( m_bp, e ) ; - continue ; + monitor.bufferUnavailable( bp, e ); + continue; } catch ( IOException e ) { - m_monitor.readFailed( l_client, e ) ; - m_bp.releaseClaim( l_buf, this ) ; - continue ; + monitor.readFailed( l_client, e ); + bp.releaseClaim( l_buf, this ); + continue; } /* @@ -411,10 +408,10 @@ * input event there are other interesed parties that have * increased the reference count. */ - m_monitor.inputRecieved( l_client ) ; - InputEvent l_event = new ConcreteInputEvent( l_client, l_buf ) ; - m_router.publish( l_event ) ; - m_bp.releaseClaim( l_buf, this ) ; + monitor.inputRecieved( l_client ); + InputEvent l_event = new ConcreteInputEvent( l_client, l_buf ); + router.publish( l_event ); + bp.releaseClaim( l_buf, this ); } } } @@ -432,18 +429,18 @@ { ConcreteInputEvent( ClientKey key, ByteBuffer buffer ) { - super( DefaultInputManager.this, key, buffer ) ; + super( DefaultInputManager.this, key, buffer ); } public ByteBuffer claimInterest( Object party ) { - m_bp.claimInterest( getBuffer(), party ) ; - return getBuffer().asReadOnlyBuffer() ; + bp.claimInterest( getBuffer(), party ); + return getBuffer().asReadOnlyBuffer(); } public void releaseInterest( Object party ) { - m_bp.releaseClaim( getBuffer(), party ) ; + bp.releaseClaim( getBuffer(), party ); } } @@ -455,7 +452,7 @@ */ public InputManagerMonitor getMonitor() { - return m_monitor ; + return monitor; } @@ -466,6 +463,6 @@ */ public void setMonitor( InputManagerMonitor monitor ) { - m_monitor = monitor ; + this.monitor = monitor; } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultListenerManager.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultListenerManager.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultListenerManager.java Sat Sep 11 17:31:18 2004 @@ -14,37 +14,36 @@ * limitations under the License. * */ -package org.apache.seda.listener ; +package org.apache.seda.listener; -import java.util.Set ; -import java.util.HashSet ; -import java.util.Iterator ; -import java.util.EventObject ; +import java.util.Set; +import java.util.HashSet; +import java.util.Iterator; +import java.util.EventObject; -import java.io.IOException ; +import java.io.IOException; -import java.net.Socket ; -import java.net.InetAddress ; -import java.net.InetSocketAddress ; +import java.net.Socket; +import java.net.InetAddress; +import java.net.InetSocketAddress; -import java.nio.channels.Selector ; -import java.nio.channels.SelectionKey ; -import java.nio.channels.SocketChannel ; -import java.nio.channels.ServerSocketChannel ; +import java.nio.channels.Selector; +import java.nio.channels.SelectionKey; +import java.nio.channels.SocketChannel; +import java.nio.channels.ServerSocketChannel; -import org.apache.seda.event.EventRouter ; -import org.apache.seda.event.ConnectEvent ; -import org.apache.seda.event.DisconnectEvent ; -import org.apache.seda.event.DisconnectSubscriber ; +import org.apache.seda.event.EventRouter; +import org.apache.seda.event.ConnectEvent; +import org.apache.seda.event.DisconnectEvent; +import org.apache.seda.event.DisconnectSubscriber; /** * A listener manager that uses non-blocking NIO based constructs to detect * client connections on server socket listeners. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultListenerManager @@ -54,24 +53,24 @@ Runnable { /** event manager used to decouple source to sink relationships */ - private final EventRouter router ; + private final EventRouter router; /** selector used to select a acceptable socket channel */ - private final Selector selector ; + private final Selector selector; /** the client keys for accepted connections */ - private final Set clients ; + private final Set clients; /** the set of listeners managed */ - private final Set listeners ; + private final Set listeners; /** new listeners waiting to be bound */ - private final Set bindListeners ; + private final Set bindListeners; /** old listeners waiting to be unbound */ - private final Set unbindListeners ; + private final Set unbindListeners; /** the thread driving this Runnable */ - private Thread thread = null ; + private Thread thread = null; /** parameter used to politely stop running thread */ - private Boolean hasStarted = null ; + private Boolean hasStarted = null; /** the listner manager's monitor */ - private ListenerManagerMonitor monitor = null ; + private ListenerManagerMonitor monitor = null; /** @@ -82,16 +81,16 @@ */ public DefaultListenerManager( EventRouter router ) throws IOException { - this.router = router ; - this.clients = new HashSet() ; - this.selector = Selector.open() ; - this.listeners = new HashSet() ; - this.hasStarted = new Boolean( false ) ; - this.bindListeners = new HashSet() ; - this.unbindListeners = new HashSet() ; + this.router = router; + this.clients = new HashSet(); + this.selector = Selector.open(); + this.listeners = new HashSet(); + this.hasStarted = new Boolean( false ); + this.bindListeners = new HashSet(); + this.unbindListeners = new HashSet(); - this.router.subscribe( DisconnectEvent.class, null, this ) ; - this.monitor = new ListenerManagerMonitorAdapter() ; + this.router.subscribe( DisconnectEvent.class, null, this ); + this.monitor = new ListenerManagerMonitorAdapter(); } @@ -102,7 +101,7 @@ */ public ListenerManagerMonitor getMonitor() { - return monitor ; + return monitor; } @@ -113,7 +112,7 @@ */ public void setMonitor( ListenerManagerMonitor monitor ) { - this.monitor = monitor ; + this.monitor = monitor; } @@ -124,10 +123,10 @@ { synchronized ( bindListeners ) { - bindListeners.add( listener ) ; + bindListeners.add( listener ); } - selector.wakeup() ; + selector.wakeup(); } @@ -138,10 +137,10 @@ { synchronized ( unbindListeners ) { - unbindListeners.add( listener ) ; + unbindListeners.add( listener ); } - selector.wakeup() ; + selector.wakeup(); } @@ -154,36 +153,36 @@ { synchronized ( bindListeners ) { - Iterator list = bindListeners.iterator() ; + Iterator list = bindListeners.iterator(); while ( list.hasNext() ) { ListenerConfig listener = - ( ListenerConfig ) list.next() ; + ( ListenerConfig ) list.next(); try { - ServerSocketChannel channel = ServerSocketChannel.open() ; + ServerSocketChannel channel = ServerSocketChannel.open(); InetSocketAddress address = new InetSocketAddress( InetAddress.getByAddress( listener.getAddress() ), - listener.getInetServiceEntry().getPort() ) ; - channel.socket().bind( address, listener.getBacklog() ) ; - channel.configureBlocking( false ) ; + listener.getInetServiceEntry().getPort() ); + channel.socket().bind( address, listener.getBacklog() ); + channel.configureBlocking( false ); channel.register( selector, SelectionKey.OP_ACCEPT, - listener ) ; + listener ); synchronized ( listeners ) { - listeners.add( listener ) ; + listeners.add( listener ); } - bindListeners.remove( listener ) ; + bindListeners.remove( listener ); } catch ( IOException e ) { - monitor.failedToBind( listener, e ) ; + monitor.failedToBind( listener, e ); } - monitor.bindOccured( listener ) ; + monitor.bindOccured( listener ); } } } @@ -196,37 +195,37 @@ */ private void unbind() { - SelectionKey key = null ; + SelectionKey key = null; synchronized ( unbindListeners ) { - Iterator keys = selector.keys().iterator() ; + Iterator keys = selector.keys().iterator(); while ( keys.hasNext() ) { - key = ( SelectionKey ) keys.next() ; + key = ( SelectionKey ) keys.next(); ListenerConfig listener = - ( ListenerConfig ) key.attachment() ; + ( ListenerConfig ) key.attachment(); if ( unbindListeners.contains( listener ) ) { try { - key.channel().close() ; + key.channel().close(); } catch ( IOException e ) { - monitor.failedToUnbind( listener, e ) ; + monitor.failedToUnbind( listener, e ); } - key.cancel() ; + key.cancel(); synchronized ( listeners ) { - listeners.remove( listener ) ; + listeners.remove( listener ); } - unbindListeners.remove( listener ) ; - monitor.unbindOccured( listener ) ; + unbindListeners.remove( listener ); + monitor.unbindOccured( listener ); } } } @@ -245,15 +244,15 @@ */ public void inform( DisconnectEvent event ) { - clients.remove( event.getClientKey() ) ; + clients.remove( event.getClientKey() ); try { - event.getClientKey().expire() ; + event.getClientKey().expire(); } catch ( IOException e ) { - monitor.failedToExpire( event.getClientKey(), e ) ; + monitor.failedToExpire( event.getClientKey(), e ); } } @@ -264,7 +263,7 @@ */ public void inform( EventObject event ) { - inform( ( DisconnectEvent ) event ) ; + inform( ( DisconnectEvent ) event ); } @@ -282,50 +281,50 @@ { try { - monitor.enteringSelect( selector ) ; + monitor.enteringSelect( selector ); - bind() ; - unbind() ; + bind(); + unbind(); if ( 0 == selector.select() ) { - monitor.selectTimedOut( selector ) ; - continue ; + monitor.selectTimedOut( selector ); + continue; } } catch( IOException e ) { - monitor.failedToSelect( selector, e ) ; - continue ; + monitor.failedToSelect( selector, e ); + continue; } - Iterator list = selector.selectedKeys().iterator() ; + Iterator list = selector.selectedKeys().iterator(); while ( list.hasNext() ) { - SelectionKey key = ( SelectionKey ) list.next() ; + SelectionKey key = ( SelectionKey ) list.next(); if ( key.isAcceptable() ) { - SocketChannel channel = null ; + SocketChannel channel = null; ServerSocketChannel server = ( ServerSocketChannel ) - key.channel() ; + key.channel(); try { - channel = server.accept() ; - list.remove() ; - monitor.acceptOccured( key ) ; + channel = server.accept(); + list.remove(); + monitor.acceptOccured( key ); } catch ( IOException e ) { - monitor.failedToAccept( key, e ) ; - continue ; + monitor.failedToAccept( key, e ); + continue; } - ClientKey clientKey = new ClientKey( channel.socket() ) ; - ConnectEvent event = new ConnectEvent( this, clientKey ) ; - router.publish( event ) ; + ClientKey clientKey = new ClientKey( channel.socket() ); + ConnectEvent event = new ConnectEvent( this, clientKey ); + router.publish( event ); } } } @@ -342,13 +341,13 @@ { if ( hasStarted.booleanValue() ) { - throw new IllegalStateException( "Already started!" ) ; + throw new IllegalStateException( "Already started!" ); } - hasStarted = new Boolean( true ) ; - thread = new Thread( this ) ; - thread.start() ; - monitor.started() ; + hasStarted = new Boolean( true ); + thread = new Thread( this ); + thread.start(); + monitor.started(); } @@ -360,8 +359,8 @@ */ public void stop() throws InterruptedException { - hasStarted = new Boolean( false ) ; - selector.wakeup() ; + hasStarted = new Boolean( false ); + selector.wakeup(); /* * First lets shutdown the listeners so we're not open to having new @@ -371,11 +370,11 @@ */ if ( ! listeners.isEmpty() ) { - Iterator list = listeners.iterator() ; + Iterator list = listeners.iterator(); while( list.hasNext() ) { ListenerConfig listener = - ( ListenerConfig ) list.next() ; + ( ListenerConfig ) list.next(); try { @@ -383,12 +382,12 @@ * put the listening in the set ready to be unbound by * the runnable's thread of execution */ - unbind( listener ) ; + unbind( listener ); } catch( IOException e ) { - // monitor.doSomthing( e ) ; - e.printStackTrace() ; + // monitor.doSomthing( e ); + e.printStackTrace(); } } } @@ -404,21 +403,21 @@ { synchronized( clients ) { - Iterator list = clients.iterator() ; + Iterator list = clients.iterator(); while ( list.hasNext() ) { - ClientKey key = ( ClientKey ) list.next() ; + ClientKey key = ( ClientKey ) list.next(); try { - Socket socket = key.getSocket() ; - socket.close() ; - list.remove() ; + Socket socket = key.getSocket(); + socket.close(); + list.remove(); } catch( IOException e ) { - // monitor.doSomthing( e ) ; - e.printStackTrace() ; + // monitor.doSomthing( e ); + e.printStackTrace(); } } } @@ -429,10 +428,10 @@ */ if ( this.thread.isAlive() ) { - Thread.sleep( 100 ) ; - selector.wakeup() ; + Thread.sleep( 100 ); + selector.wakeup(); } - monitor.stopped() ; + monitor.stopped(); } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/DefaultOutputManager.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/DefaultOutputManager.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/DefaultOutputManager.java Sat Sep 11 17:31:18 2004 @@ -14,39 +14,38 @@ * limitations under the License. * */ -package org.apache.seda.output ; +package org.apache.seda.output; -import java.io.IOException ; +import java.io.IOException; -import java.nio.ByteBuffer ; -import java.nio.channels.SocketChannel ; +import java.nio.ByteBuffer; +import java.nio.channels.SocketChannel; -import java.util.Map ; -import java.util.HashMap ; -import java.util.EventObject ; - -import org.apache.seda.event.EventRouter ; -import org.apache.seda.event.OutputEvent ; -import org.apache.seda.stage.DefaultStage ; -import org.apache.seda.stage.StageHandler ; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.ConnectEvent ; -import org.apache.seda.event.DisconnectEvent ; -import org.apache.seda.event.OutputSubscriber ; -import org.apache.seda.event.ConnectSubscriber ; -import org.apache.seda.stage.DefaultStageConfig ; -import org.apache.seda.event.AbstractSubscriber ; -import org.apache.seda.stage.LoggingStageMonitor ; -import org.apache.seda.event.DisconnectSubscriber ; -import org.apache.seda.listener.KeyExpiryException ; +import java.util.Map; +import java.util.HashMap; +import java.util.EventObject; + +import org.apache.seda.event.EventRouter; +import org.apache.seda.event.OutputEvent; +import org.apache.seda.stage.DefaultStage; +import org.apache.seda.stage.StageHandler; +import org.apache.seda.listener.ClientKey; +import org.apache.seda.event.ConnectEvent; +import org.apache.seda.event.DisconnectEvent; +import org.apache.seda.event.OutputSubscriber; +import org.apache.seda.event.ConnectSubscriber; +import org.apache.seda.stage.DefaultStageConfig; +import org.apache.seda.event.AbstractSubscriber; +import org.apache.seda.stage.LoggingStageMonitor; +import org.apache.seda.event.DisconnectSubscriber; +import org.apache.seda.listener.KeyExpiryException; /** * The default OutputManager implementation. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultOutputManager extends DefaultStage @@ -57,11 +56,11 @@ DisconnectSubscriber { /** the router we subscribe for OutputEvents on */ - private final EventRouter router ; + private final EventRouter router; /** the monitor used to track notable events in this OutputManager */ - private OutputMonitor monitor ; + private OutputMonitor monitor; /** a map of channels by ClientKey */ - private Map channels = new HashMap() ; + private Map channels = new HashMap(); // ------------------------------------------------------------------------ @@ -77,14 +76,14 @@ */ public DefaultOutputManager( EventRouter router, DefaultStageConfig config ) { - super( config ) ; - this.router = router ; - this.router.subscribe( OutputEvent.class, this ) ; - this.router.subscribe( ConnectEvent.class, this ) ; - this.router.subscribe( DisconnectEvent.class, this ) ; - config.setHandler( new OutputStageHandler() ) ; - this.setMonitor( new LoggingStageMonitor() ) ; - this.setOutputMonitor( new LoggingOutputMonitor() ) ; + super( config ); + this.router = router; + this.router.subscribe( OutputEvent.class, this ); + this.router.subscribe( ConnectEvent.class, this ); + this.router.subscribe( DisconnectEvent.class, this ); + config.setHandler( new OutputStageHandler() ); + this.setMonitor( new LoggingStageMonitor() ); + this.setOutputMonitor( new LoggingOutputMonitor() ); } @@ -100,11 +99,11 @@ { try { - AbstractSubscriber.inform( this, event ) ; + AbstractSubscriber.inform( this, event ); } catch( Throwable t ) { - monitor.failedOnInform( this, event, t ) ; + monitor.failedOnInform( this, event, t ); } } @@ -115,7 +114,7 @@ */ public void inform( OutputEvent event ) { - enqueue( event ) ; + enqueue( event ); } @@ -125,18 +124,18 @@ */ public void inform( ConnectEvent event ) { - ClientKey key = event.getClientKey() ; + ClientKey key = event.getClientKey(); try { - channels.put( key, key.getSocket().getChannel() ) ; + channels.put( key, key.getSocket().getChannel() ); } catch( KeyExpiryException e ) { - monitor.keyExpired( this, key, e ) ; + monitor.keyExpired( this, key, e ); } - monitor.addedClient( this, event ) ; + monitor.addedClient( this, event ); } @@ -146,8 +145,8 @@ */ public void inform( DisconnectEvent event ) { - channels.remove( event.getClientKey() ) ; - monitor.removedClient( this, event ) ; + channels.remove( event.getClientKey() ); + monitor.removedClient( this, event ); } @@ -164,35 +163,35 @@ public void write( ClientKey key, ByteBuffer buf ) throws IOException { - Object lock = null ; - SocketChannel channel = ( SocketChannel ) channels.get( key ) ; + Object lock = null; + SocketChannel channel = ( SocketChannel ) channels.get( key ); if ( null == channel ) { - monitor.channelMissing( this, key ) ; - return ; + monitor.channelMissing( this, key ); + return; } // Obtain output lock for write to client. try { - lock = key.getOutputLock() ; + lock = key.getOutputLock(); } catch ( KeyExpiryException e ) { - monitor.keyExpired( this, key, e ) ; - return ; + monitor.keyExpired( this, key, e ); + return; } // synchronize on client output stream lock object. synchronized( lock ) { - monitor.writeLockAcquired( this, key ) ; - channel.write( buf ) ; - lock.notifyAll() ; + monitor.writeLockAcquired( this, key ) ; + channel.write( buf ); + lock.notifyAll(); } - monitor.writeOccurred( this, key ) ; + monitor.writeOccurred( this, key ); } @@ -203,7 +202,7 @@ */ public void setOutputMonitor( OutputMonitor monitor ) { - this.monitor = monitor ; + this.monitor = monitor; } @@ -216,16 +215,16 @@ { if ( generic instanceof OutputEvent ) { - OutputEvent event = ( OutputEvent ) generic ; + OutputEvent event = ( OutputEvent ) generic; try { - write( event.getClientKey(), event.getBuffer() ) ; + write( event.getClientKey(), event.getBuffer() ); } catch ( IOException e ) { monitor.failedOnWrite( DefaultOutputManager.this, - event.getClientKey(), e ) ; + event.getClientKey(), e ); } } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/LoggingOutputMonitor.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/LoggingOutputMonitor.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/LoggingOutputMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,19 +14,19 @@ * limitations under the License. * */ -package org.apache.seda.output ; +package org.apache.seda.output; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.commons.logging.Log ; -import org.apache.commons.logging.LogFactory ; -import org.apache.commons.lang.exception.ExceptionUtils ; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.seda.event.ConnectEvent ; -import org.apache.seda.listener.ClientKey ; -import org.apache.seda.event.DisconnectEvent ; -import org.apache.seda.listener.KeyExpiryException ; +import org.apache.seda.event.ConnectEvent; +import org.apache.seda.listener.ClientKey; +import org.apache.seda.event.DisconnectEvent; +import org.apache.seda.listener.KeyExpiryException; import org.apache.seda.output.OutputMonitor; import org.apache.seda.output.OutputManager; @@ -34,13 +34,12 @@ /** * A logging monitor for any OutputManager. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class LoggingOutputMonitor implements OutputMonitor { - private final Log log = LogFactory.getLog( "OutputManager" ) ; + private final Log log = LogFactory.getLog( "OutputManager" ); /* (non-Javadoc) @@ -55,7 +54,7 @@ { log.error( manager + " failed while trying to write to client " + key + ":\n" - + ExceptionUtils.getFullStackTrace( t ) ) ; + + ExceptionUtils.getFullStackTrace( t ) ); } } @@ -68,7 +67,7 @@ { if ( log.isDebugEnabled() ) { - log.debug( manager + " wrote to client " + key ) ; + log.debug( manager + " wrote to client " + key ); } } @@ -81,7 +80,7 @@ { if ( log.isTraceEnabled() ) { - log.trace( manager + " locked channel for client " + key ) ; + log.trace( manager + " locked channel for client " + key ); } } @@ -94,7 +93,7 @@ { if ( log.isWarnEnabled() ) { - log.warn( manager + " could not find channel for client " + key ) ; + log.warn( manager + " could not find channel for client " + key ); } } @@ -110,7 +109,7 @@ if ( log.isWarnEnabled() ) { log.warn( manager + " cannot use expired key for client " + key - + ":\n" + ExceptionUtils.getFullStackTrace( e ) ) ; + + ":\n" + ExceptionUtils.getFullStackTrace( e ) ); } } @@ -125,7 +124,7 @@ { if ( log.isErrorEnabled() ) { - log.error( manager + " failed to be informed of " + event ) ; + log.error( manager + " failed to be informed of " + event ); } } @@ -138,7 +137,7 @@ { if ( log.isDebugEnabled() ) { - log.debug( manager + " added client " + event.getClientKey() ) ; + log.debug( manager + " added client " + event.getClientKey() ); } } @@ -152,7 +151,7 @@ { if ( log.isDebugEnabled() ) { - log.debug( manager + " removed client " + event.getClientKey() ) ; + log.debug( manager + " removed client " + event.getClientKey() ); } } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/protocol/DefaultRequestProcessor.java Sat Sep 11 17:31:18 2004 @@ -14,21 +14,21 @@ * limitations under the License. * */ -package org.apache.seda.processor ; +package org.apache.seda.processor; -import java.util.Iterator ; -import java.util.EventObject ; +import java.util.Iterator; +import java.util.EventObject; import org.apache.commons.lang.NotImplementedException; -import org.apache.seda.event.EventRouter ; -import org.apache.seda.event.RequestEvent ; -import org.apache.seda.event.ResponseEvent ; -import org.apache.seda.event.RequestSubscriber ; -import org.apache.seda.event.AbstractSubscriber ; +import org.apache.seda.event.EventRouter; +import org.apache.seda.event.RequestEvent; +import org.apache.seda.event.ResponseEvent; +import org.apache.seda.event.RequestSubscriber; +import org.apache.seda.event.AbstractSubscriber; -import org.apache.seda.listener.ClientKey ; +import org.apache.seda.listener.ClientKey; import org.apache.seda.stage.*; import org.apache.seda.protocol.*; @@ -36,15 +36,14 @@ /** * Default RequestProcessor service implemented as a POJO. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultRequestProcessor extends DefaultStage implements RequestProcessor, RequestSubscriber { - private final EventRouter router ; - private RequestProcessorMonitor monitor = null ; + private final EventRouter router; + private RequestProcessorMonitor monitor = null; /** @@ -55,15 +54,15 @@ */ public DefaultRequestProcessor( EventRouter router, StageConfig config ) { - super( config ) ; + super( config ); - DefaultStageConfig defaultConfig = ( DefaultStageConfig ) config ; - defaultConfig.setHandler( new ProcessorStageHandler() ) ; - super.setMonitor( new LoggingStageMonitor( getClass() ) ) ; + DefaultStageConfig defaultConfig = ( DefaultStageConfig ) config; + defaultConfig.setHandler( new ProcessorStageHandler() ); + super.setMonitor( new LoggingStageMonitor( getClass() ) ); - this.router = router ; - this.router.subscribe( RequestEvent.class, this ) ; - this.monitor = new RequestProcessorMonitorAdapter() ; + this.router = router; + this.router.subscribe( RequestEvent.class, this ); + this.monitor = new RequestProcessorMonitorAdapter(); } @@ -73,7 +72,7 @@ */ public void inform( RequestEvent event ) { - enqueue( event ) ; + enqueue( event ); } @@ -84,11 +83,11 @@ { try { - AbstractSubscriber.inform( this, event ) ; + AbstractSubscriber.inform( this, event ); } catch ( Throwable t ) { - monitor.failedOnInform( this, event, t ) ; + monitor.failedOnInform( this, event, t ); } } @@ -102,8 +101,8 @@ */ public void handleEvent( EventObject nonspecific ) { - RequestEvent event = ( RequestEvent ) nonspecific ; - ClientKey key = event.getClientKey() ; + RequestEvent event = ( RequestEvent ) nonspecific; + ClientKey key = event.getClientKey(); RequestHandler handler = getProtocolHandler( event.getClientKey(), event.getRequest() ); @@ -111,21 +110,21 @@ switch( handler.getHandlerType().getValue() ) { case( HandlerTypeEnum.NOREPLY_VAL ): - NoReplyHandler noreply = ( NoReplyHandler ) handler ; - noreply.handle( event.getRequest() ) ; - break ; + NoReplyHandler noreply = ( NoReplyHandler ) handler; + noreply.handle( event.getRequest() ); + break; case( HandlerTypeEnum.SINGLEREPLY_VAL ): - SingleReplyHandler single = ( SingleReplyHandler ) handler ; - reply( single, event.getRequest(), key ) ; - break ; + SingleReplyHandler single = ( SingleReplyHandler ) handler; + reply( single, event.getRequest(), key ); + break; case( HandlerTypeEnum.MANYREPLY_VAL ): - ManyReplyHandler many = ( ManyReplyHandler ) handler ; - reply( many, event.getRequest(), key ) ; - break ; + ManyReplyHandler many = ( ManyReplyHandler ) handler; + reply( many, event.getRequest(), key ); + break; default: throw new IllegalArgumentException( "Unrecognized handler type: " - + handler.getHandlerType() ) ; + + handler.getHandlerType() ); } } } @@ -152,17 +151,17 @@ Object request, ClientKey key ) { - Object response = null ; + Object response = null; try { - Iterator list = handler.handle( request ) ; + Iterator list = handler.handle( request ); if ( handler.isSequential() ) { while ( list.hasNext() ) { - response = list.next() ; + response = list.next(); // @todo: need to force serialized response processing // perhaps we need to add an isResponseOrdered or a @@ -176,7 +175,7 @@ { while ( list.hasNext() ) { - response = list.next() ; + response = list.next(); router.publish( new ResponseEvent( this, key, response ) ); } } @@ -184,7 +183,7 @@ catch( Throwable t ) { - monitor.failedOnSingleReply( key, request, t ) ; + monitor.failedOnSingleReply( key, request, t ); } } @@ -198,11 +197,11 @@ private void reply( SingleReplyHandler handler, Object request, ClientKey key ) { - Object response = null ; + Object response = null; try { - response = handler.handle( request ) ; + response = handler.handle( request ); } // If the individual handlers do not do a global catch and report this @@ -210,10 +209,10 @@ // at a minimum the stack trace that cause the request to fail. catch( Throwable t ) { - monitor.failedOnSingleReply( key, request, t ) ; + monitor.failedOnSingleReply( key, request, t ); return; } - router.publish( new ResponseEvent( this, key, response ) ) ; + router.publish( new ResponseEvent( this, key, response ) ); } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/DefaultStage.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/DefaultStage.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/DefaultStage.java Sat Sep 11 17:31:18 2004 @@ -14,25 +14,19 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; -import org.apache.seda.stage.Stage; -import org.apache.seda.stage.StageConfig; -import org.apache.seda.stage.StageMonitor; -import org.apache.seda.stage.EnqueuePredicate; - -import java.util.Set ; -import java.util.HashSet ; -import java.util.LinkedList ; -import java.util.EventObject ; +import java.util.Set; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.EventObject; /** * The default Stage implementation. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultStage implements Stage @@ -41,21 +35,21 @@ * time to sleep in milliseconds waiting for this stage to stop * @todo migth want add this to config and use this as the default value */ - private static final long STOP_WAIT = 100 ; + private static final long STOP_WAIT = 100; /** the configuration bean */ - protected final StageConfig config ; + protected final StageConfig config; /** this Stage's event queue */ - private final LinkedList queue = new LinkedList() ; + private final LinkedList queue = new LinkedList(); /** this Stage's active handler threads */ - private final Set activeWorkers = new HashSet() ; + private final Set activeWorkers = new HashSet(); /** this Stage's StageDriver's driving thread */ - private Thread thread = null ; + private Thread thread = null; /** the start stop control variable */ - private Boolean hasStarted = new Boolean( false ) ; + private Boolean hasStarted = new Boolean( false ); /** this Stage's monitor */ - private StageMonitor monitor = new StageMonitorAdapter() ; + private StageMonitor monitor = new StageMonitorAdapter(); // ------------------------------------------------------------------------ @@ -70,8 +64,8 @@ */ public DefaultStage( StageConfig config ) { - this.config = config ; - hasStarted = new Boolean( false ) ; + this.config = config; + hasStarted = new Boolean( false ); } @@ -87,8 +81,8 @@ */ public void addPredicate( EnqueuePredicate predicate ) { - config.getPredicates().add( predicate ) ; - monitor.predicateAdded( this, predicate ) ; + config.getPredicates().add( predicate ); + monitor.predicateAdded( this, predicate ); } @@ -97,7 +91,7 @@ */ public StageConfig getConfig() { - return config ; + return config; } @@ -110,36 +104,36 @@ */ public void enqueue( final EventObject event ) { - boolean isAccepted = true ; + boolean isAccepted = true; if ( ! hasStarted.booleanValue() ) { - monitor.enqueueRejected( this, event ) ; - return ; + monitor.enqueueRejected( this, event ); + return; } - for ( int ii = 0; ii < config.getPredicates().size() && isAccepted ; + for ( int ii = 0; ii < config.getPredicates().size() && isAccepted; ii++ ) { EnqueuePredicate test = - ( EnqueuePredicate ) config.getPredicates().get( ii ) ; - isAccepted &= test.accept( event ) ; + ( EnqueuePredicate ) config.getPredicates().get( ii ); + isAccepted &= test.accept( event ); } if( isAccepted ) { synchronized ( queue ) { - monitor.lockedQueue( this, event ) ; - queue.addFirst( event ) ; - queue.notifyAll() ; + monitor.lockedQueue( this, event ); + queue.addFirst( event ); + queue.notifyAll(); } - monitor.enqueueOccurred( this, event ) ; + monitor.enqueueOccurred( this, event ); } else { - monitor.enqueueRejected( this, event ) ; + monitor.enqueueRejected( this, event ); } } @@ -160,7 +154,7 @@ { public final void run() { - monitor.startedDriver( DefaultStage.this ) ; + monitor.startedDriver( DefaultStage.this ); /* * keep processing until the hasStarted variable is toggled off @@ -171,30 +165,30 @@ { synchronized ( queue ) { - monitor.lockedQueue( DefaultStage.this ) ; + monitor.lockedQueue( DefaultStage.this ); if( queue.isEmpty() ) { try { - monitor.waiting( DefaultStage.this ) ; - queue.wait() ; - monitor.notified( DefaultStage.this ) ; + monitor.waiting( DefaultStage.this ); + queue.wait(); + monitor.notified( DefaultStage.this ); } catch( InterruptedException e ) { - try { stop() ; } catch ( Exception e2 ) + try { stop(); } catch ( Exception e2 ) {/*NOT THROWN*/} - monitor.driverFailed( DefaultStage.this, e ) ; + monitor.driverFailed( DefaultStage.this, e ); } } else { - EventObject event = ( EventObject ) queue.removeLast() ; - monitor.eventDequeued( DefaultStage.this, event ) ; - Runnable l_runnable = new ExecutableHandler( event ) ; - config.getThreadPool().execute( l_runnable ) ; - monitor.eventHandled( DefaultStage.this, event ) ; + EventObject event = ( EventObject ) queue.removeLast(); + monitor.eventDequeued( DefaultStage.this, event ); + Runnable l_runnable = new ExecutableHandler( event ); + config.getThreadPool().execute( l_runnable ); + monitor.eventHandled( DefaultStage.this, event ); } } } @@ -211,35 +205,35 @@ */ class ExecutableHandler implements Runnable { - final EventObject m_event ; + final EventObject m_event; public ExecutableHandler( EventObject event ) { - m_event = event ; + m_event = event; } public void run() { - activeWorkers.add( Thread.currentThread() ) ; + activeWorkers.add( Thread.currentThread() ); try { if ( config.getHandler() == null ) { - monitor.handlerMissing( DefaultStage.this ) ; + monitor.handlerMissing( DefaultStage.this ); } else { - config.getHandler().handleEvent( m_event ) ; + config.getHandler().handleEvent( m_event ); } } catch( Throwable t ) { - monitor.handlerFailed( DefaultStage.this, m_event, t ) ; + monitor.handlerFailed( DefaultStage.this, m_event, t ); } finally { - activeWorkers.remove( Thread.currentThread() ) ; + activeWorkers.remove( Thread.currentThread() ); } } } @@ -257,14 +251,14 @@ { if ( hasStarted.booleanValue() ) { - throw new IllegalStateException( "Already started!" ) ; + throw new IllegalStateException( "Already started!" ); } - hasStarted = new Boolean( true ) ; - thread = new Thread( new StageDriver() ) ; - thread.start() ; + hasStarted = new Boolean( true ); + thread = new Thread( new StageDriver() ); + thread.start(); - monitor.started( this ) ; + monitor.started( this ); } @@ -274,21 +268,21 @@ */ public void stop() throws InterruptedException { - hasStarted = new Boolean( false ) ; - monitor.stopping( this ) ; + hasStarted = new Boolean( false ); + monitor.stopping( this ); while ( thread.isAlive() || ! activeWorkers.isEmpty() ) { - monitor.stopping( this, STOP_WAIT ) ; - Thread.sleep( STOP_WAIT ) ; + monitor.stopping( this, STOP_WAIT ); + Thread.sleep( STOP_WAIT ); synchronized( queue ) { - queue.notifyAll() ; + queue.notifyAll(); } } - monitor.stopped( this ) ; + monitor.stopped( this ); } @@ -299,7 +293,7 @@ */ public boolean hasStarted() { - return hasStarted.booleanValue() ; + return hasStarted.booleanValue(); } @@ -310,7 +304,7 @@ */ public StageMonitor getStageMonitor() { - return monitor ; + return monitor; } @@ -321,6 +315,6 @@ */ public void setMonitor( StageMonitor monitor ) { - this.monitor = monitor ; + this.monitor = monitor; } } Modified: incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/LoggingStageMonitor.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/LoggingStageMonitor.java (original) +++ incubator/directory/seda/trunk/impl/src/java/org/apache/seda/stage/LoggingStageMonitor.java Sat Sep 11 17:31:18 2004 @@ -14,16 +14,16 @@ * limitations under the License. * */ -package org.apache.seda.stage ; +package org.apache.seda.stage; -import java.util.EventObject ; +import java.util.EventObject; -import org.apache.commons.lang.Validate ; -import org.apache.commons.lang.ClassUtils ; +import org.apache.commons.lang.Validate; +import org.apache.commons.lang.ClassUtils; -import org.apache.commons.logging.Log ; -import org.apache.commons.logging.LogFactory ; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** @@ -31,13 +31,13 @@ * exceptions that occur on failure exception notifications to stderr. This * is just for safty since we do not want to ignore these exceptions. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class LoggingStageMonitor implements StageMonitor { - private final Log log ; + /** the commons-logging log to log to */ + private final Log log; /** @@ -45,7 +45,7 @@ */ public LoggingStageMonitor() { - log = LogFactory.getLog( DefaultStage.class ) ; + log = LogFactory.getLog( DefaultStage.class ); } @@ -58,8 +58,8 @@ public LoggingStageMonitor( Class clazz ) { Validate.isTrue( ClassUtils.isAssignable( clazz, Stage.class ), - clazz.getName() + " does not implement the Stage interface" ) ; - log = LogFactory.getLog( DefaultStage.class ) ; + clazz.getName() + " does not implement the Stage interface" ); + log = LogFactory.getLog( DefaultStage.class ); } @@ -72,7 +72,7 @@ if ( log.isErrorEnabled() ) { log.error( "Stage " + stage.getConfig().getName() - + " does not have a handler assigned" ) ; + + " does not have a handler assigned" ); } } @@ -84,7 +84,7 @@ { if ( log.isDebugEnabled() ) { - log.debug( stage.getConfig().getName() + " has started!" ) ; + log.debug( stage.getConfig().getName() + " has started!" ); } } @@ -96,7 +96,7 @@ { if ( log.isDebugEnabled() ) { - log.debug( stage.getConfig().getName() + " has stopped!" ) ; + log.debug( stage.getConfig().getName() + " has stopped!" ); } } @@ -110,7 +110,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() - + "'s driver started execution!" ) ; + + "'s driver started execution!" ); } } @@ -124,7 +124,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() + " had event " - + getDesc( event ) + " enqueued!" ) ; + + getDesc( event ) + " enqueued!" ); } } @@ -138,7 +138,7 @@ if ( log.isWarnEnabled() ) { log.warn( stage.getConfig().getName() + " had event " - + getDesc( event ) + " enqueue REJECTED!" ) ; + + getDesc( event ) + " enqueue REJECTED!" ); } } @@ -152,7 +152,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() - + "'s queue locked for processing " + getDesc( event ) ) ; + + "'s queue locked for processing " + getDesc( event ) ); } } @@ -166,7 +166,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() - + "'s queue locked by awoken stage driver thread" ) ; + + "'s queue locked by awoken stage driver thread" ); } } @@ -179,7 +179,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() - + "'s driver thread notified out of waiting" ) ; + + "'s driver thread notified out of waiting" ); } } @@ -192,7 +192,7 @@ if ( log.isInfoEnabled() ) { log.info( "Graceful shutdown of stage " - + stage.getConfig().getName() + " was requested" ) ; + + stage.getConfig().getName() + " was requested" ); } } @@ -206,7 +206,7 @@ if ( log.isInfoEnabled() ) { log.info( "Waiting " + millis + " for graceful shutdown of stage " - + stage.getConfig().getName() ) ; + + stage.getConfig().getName() ); } } @@ -220,7 +220,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() - + "'s stage queue is empty, driver thread is waiting" ) ; + + "'s stage queue is empty, driver thread is waiting" ); } } @@ -234,7 +234,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() + " had event " - + getDesc( event ) + " dequeued!" ) ; + + getDesc( event ) + " dequeued!" ); } } @@ -248,7 +248,7 @@ if ( log.isDebugEnabled() ) { log.debug( stage.getConfig().getName() + " handled " - + getDesc( event ) ) ; + + getDesc( event ) ); } } @@ -262,7 +262,7 @@ if ( log.isErrorEnabled() ) { log.error( stage.getConfig().getName() - + "'s driver failed", fault ) ; + + "'s driver failed", fault ); } } @@ -276,7 +276,7 @@ if ( log.isErrorEnabled() ) { log.error( stage.getConfig().getName() - + "'s handler failed", fault ) ; + + "'s handler failed", fault ); } } @@ -292,7 +292,7 @@ if ( log.isDebugEnabled() ) { log.debug( "predicate added to stage " - + stage.getConfig().getName() ) ; + + stage.getConfig().getName() ); } } @@ -305,6 +305,6 @@ */ private String getDesc( EventObject event ) { - return ClassUtils.getShortClassName( event.getClass() ) ; + return ClassUtils.getShortClassName( event.getClass() ); } } Modified: incubator/directory/seda/trunk/impl/src/test/org/apache/seda/buffer/DefaultBufferPoolTest.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/test/org/apache/seda/buffer/DefaultBufferPoolTest.java (original) +++ incubator/directory/seda/trunk/impl/src/test/org/apache/seda/buffer/DefaultBufferPoolTest.java Sat Sep 11 17:31:18 2004 @@ -14,14 +14,14 @@ * limitations under the License. * */ -package org.apache.seda.buffer ; +package org.apache.seda.buffer; import java.nio.ByteBuffer; import org.apache.seda.ResourceException; -import junit.framework.TestCase ; +import junit.framework.TestCase; /** @@ -36,7 +36,7 @@ public static void main( String[] args ) { - junit.textui.TestRunner.run( DefaultBufferPoolTest.class ) ; + junit.textui.TestRunner.run( DefaultBufferPoolTest.class ); } @@ -46,11 +46,11 @@ */ public DefaultBufferPoolTest( String arg0 ) { - super( arg0 ) ; + super( arg0 ); } - DefaultBufferPool m_bp = null ; + DefaultBufferPool m_bp = null; @@ -59,11 +59,11 @@ */ public void setUp() throws Exception { - super.setUp() ; + super.setUp(); DefaultBufferPoolConfig l_config = new DefaultBufferPoolConfig( - "default", 4, 10, 2, 4096 ) ; - m_bp = new DefaultBufferPool( l_config ) ; - m_bp.setMonitor( new LoggingBufferMonitor() ) ; + "default", 4, 10, 2, 4096 ); + m_bp = new DefaultBufferPool( l_config ); + m_bp.setMonitor( new LoggingBufferMonitor() ); } @@ -72,90 +72,90 @@ */ public void tearDown() throws Exception { - m_bp = null ; - super.tearDown() ; + m_bp = null; + super.tearDown(); } public void testGetConfig() throws Exception { - BufferPoolConfig l_config = m_bp.getConfig() ; - assertNotNull( "Configuration was null", l_config ) ; + BufferPoolConfig l_config = m_bp.getConfig(); + assertNotNull( "Configuration was null", l_config ); } public void testGetBuffer() throws Exception { - final int l_max = m_bp.getConfig().getMaximumSize() ; - ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ; + final int l_max = m_bp.getConfig().getMaximumSize(); + ByteBuffer[] l_buffers = new ByteBuffer[ l_max ]; for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ ) { - l_buffers[ii] = m_bp.getBuffer( this ) ; - assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ; + l_buffers[ii] = m_bp.getBuffer( this ); + assertNotNull( "Got null ByteBuffer", l_buffers[ii] ); } - ByteBuffer l_buf = null ; + ByteBuffer l_buf = null; try { - l_buf = m_bp.getBuffer( this ) ; + l_buf = m_bp.getBuffer( this ); } catch( ResourceException e ) { - assertNull( l_buf ) ; - assertNotNull( e ) ; + assertNull( l_buf ); + assertNotNull( e ); } } public void testGetFreeCount() throws Exception { - final int l_max = m_bp.getConfig().getMaximumSize() ; - ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ; + final int l_max = m_bp.getConfig().getMaximumSize(); + ByteBuffer[] l_buffers = new ByteBuffer[ l_max ]; for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ ) { - l_buffers[ii] = m_bp.getBuffer( this ) ; - assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ; + l_buffers[ii] = m_bp.getBuffer( this ); + assertNotNull( "Got null ByteBuffer", l_buffers[ii] ); assertEquals( "Free count was off", m_bp.size() - ii - 1, - m_bp.getFreeCount() ) ; + m_bp.getFreeCount() ); } - ByteBuffer l_buf = null ; + ByteBuffer l_buf = null; try { - l_buf = m_bp.getBuffer( this ) ; + l_buf = m_bp.getBuffer( this ); } catch( ResourceException e ) { - assertNull( l_buf ) ; - assertNotNull( e ) ; + assertNull( l_buf ); + assertNotNull( e ); } } public void testGetInUseCount() throws Exception { - final int l_max = m_bp.getConfig().getMaximumSize() ; - ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ; + final int l_max = m_bp.getConfig().getMaximumSize(); + ByteBuffer[] l_buffers = new ByteBuffer[ l_max ]; for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ ) { - l_buffers[ii] = m_bp.getBuffer( this ) ; - assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ; + l_buffers[ii] = m_bp.getBuffer( this ); + assertNotNull( "Got null ByteBuffer", l_buffers[ii] ); assertEquals( "In use count was off", ii+1, - m_bp.getInUseCount() ) ; + m_bp.getInUseCount() ); } - ByteBuffer l_buf = null ; + ByteBuffer l_buf = null; try { - l_buf = m_bp.getBuffer( this ) ; + l_buf = m_bp.getBuffer( this ); } catch( ResourceException e ) { - assertNull( l_buf ) ; - assertNotNull( e ) ; + assertNull( l_buf ); + assertNotNull( e ); } } @@ -163,28 +163,28 @@ public void testGetInterestedCount() throws Exception { - final int l_max = m_bp.getConfig().getMaximumSize() ; - ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ; + final int l_max = m_bp.getConfig().getMaximumSize(); + ByteBuffer[] l_buffers = new ByteBuffer[ l_max ]; for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ ) { - l_buffers[ii] = m_bp.getBuffer( this ) ; - assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ; + l_buffers[ii] = m_bp.getBuffer( this ); + assertNotNull( "Got null ByteBuffer", l_buffers[ii] ); assertEquals( "In use count was off", ii+1, - m_bp.getInUseCount() ) ; + m_bp.getInUseCount() ); assertEquals( "Interest count was off", - 1, m_bp.getInterestedCount( l_buffers[ii] ) ) ; + 1, m_bp.getInterestedCount( l_buffers[ii] ) ); } - ByteBuffer l_buf = null ; + ByteBuffer l_buf = null; try { - l_buf = m_bp.getBuffer( this ) ; + l_buf = m_bp.getBuffer( this ); } catch( ResourceException e ) { - assertNull( l_buf ) ; - assertNotNull( e ) ; + assertNull( l_buf ); + assertNotNull( e ); } } @@ -198,41 +198,41 @@ public void testSize() throws Exception { - final int l_max = m_bp.getConfig().getMaximumSize() ; - ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ; + final int l_max = m_bp.getConfig().getMaximumSize(); + ByteBuffer[] l_buffers = new ByteBuffer[ l_max ]; for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ ) { - l_buffers[ii] = m_bp.getBuffer( this ) ; - assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ; + l_buffers[ii] = m_bp.getBuffer( this ); + assertNotNull( "Got null ByteBuffer", l_buffers[ii] ); if ( ii < 2 ) { - assertEquals( "size was off", 2, m_bp.size() ) ; + assertEquals( "size was off", 2, m_bp.size() ); } else if ( ii >= 2 && ii < 6 ) { - assertEquals( "size was off", 6, m_bp.size() ) ; + assertEquals( "size was off", 6, m_bp.size() ); } else if ( ii >= 6 && ii < 10 ) { - assertEquals( "size was off", 10, m_bp.size() ) ; + assertEquals( "size was off", 10, m_bp.size() ); } else { - throw new IllegalStateException( "should never get here!" ) ; + throw new IllegalStateException( "should never get here!" ); } } - ByteBuffer l_buf = null ; + ByteBuffer l_buf = null; try { - l_buf = m_bp.getBuffer( this ) ; + l_buf = m_bp.getBuffer( this ); } catch( ResourceException e ) { - assertNull( l_buf ) ; - assertNotNull( e ) ; + assertNull( l_buf ); + assertNotNull( e ); } } } Modified: incubator/directory/seda/trunk/impl/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java (original) +++ incubator/directory/seda/trunk/impl/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java Sat Sep 11 17:31:18 2004 @@ -14,10 +14,10 @@ * limitations under the License. * */ -package org.apache.seda.decoder ; +package org.apache.seda.decoder; -import java.util.EventObject ; +import java.util.EventObject; import java.util.Iterator; import org.apache.seda.buffer.BufferPool; @@ -25,8 +25,8 @@ import org.apache.seda.buffer.DefaultBufferPool; import org.apache.seda.buffer.DefaultBufferPoolConfig; import org.apache.seda.event.AbstractSubscriber; -import org.apache.seda.event.EventRouter ; -import org.apache.seda.event.DefaultEventRouter ; +import org.apache.seda.event.EventRouter; +import org.apache.seda.event.DefaultEventRouter; import org.apache.seda.event.RequestEvent; import org.apache.seda.event.RequestSubscriber; @@ -35,31 +35,30 @@ import org.apache.seda.protocol.InetServicesDatabase; import org.apache.seda.protocol.InetServiceEntry; -import junit.framework.TestCase ; +import junit.framework.TestCase; /** * Tests the decoder manager pojo. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultDecoderManagerTest extends TestCase implements RequestSubscriber { - private ThreadPool tpool = null ; - private EventRouter router = null ; - private BufferPoolConfig bpConfig = null ; - private DefaultStageConfig config = null ; - private BufferPool bp = null ; - private DefaultDecoderManager decodeMan = null ; - private RequestEvent event = null ; + private ThreadPool tpool = null; + private EventRouter router = null; + private BufferPoolConfig bpConfig = null; + private DefaultStageConfig config = null; + private BufferPool bp = null; + private DefaultDecoderManager decodeMan = null; + private RequestEvent event = null; public static void main( String[] args ) { - junit.textui.TestRunner.run( DefaultDecoderManagerTest.class ) ; + junit.textui.TestRunner.run( DefaultDecoderManagerTest.class ); } @@ -68,12 +67,12 @@ */ protected void setUp() throws Exception { - super.setUp() ; + super.setUp(); - bpConfig = new DefaultBufferPoolConfig( "default", 10, 100, 10, 1024 ) ; - bp = new DefaultBufferPool( bpConfig ) ; - router = new DefaultEventRouter() ; - router.subscribe( RequestEvent.class, this ) ; + bpConfig = new DefaultBufferPoolConfig( "default", 10, 100, 10, 1024 ); + bp = new DefaultBufferPool( bpConfig ); + router = new DefaultEventRouter(); + router.subscribe( RequestEvent.class, this ); tpool = new ThreadPool() { /* (non-Javadoc) @@ -82,11 +81,11 @@ public void execute( Runnable runnable ) { // fake it out - runnable.run() ; + runnable.run(); } - } ; + }; - config = new DefaultStageConfig( "default", tpool ) ; + config = new DefaultStageConfig( "default", tpool ); decodeMan = new DefaultDecoderManager( router, config, new InetServicesDatabase() { @@ -114,9 +113,9 @@ { return null; } - }) ; - config.setHandler( new DecodeStageHandler( decodeMan ) ) ; - decodeMan.start() ; + }); + config.setHandler( new DecodeStageHandler( decodeMan ) ); + decodeMan.start(); } @@ -125,16 +124,16 @@ */ protected void tearDown() throws Exception { - super.tearDown() ; + super.tearDown(); - tpool = null ; - router = null ; - bpConfig = null ; - config = null ; - bp = null ; - decodeMan.stop() ; - decodeMan = null ; - event = null ; + tpool = null; + router = null; + bpConfig = null; + config = null; + bp = null; + decodeMan.stop(); + decodeMan = null; + event = null; } @@ -144,14 +143,14 @@ */ public DefaultDecoderManagerTest(String arg0) { - super( arg0 ) ; + super( arg0 ); } public void inform( RequestEvent event ) { - System.out.println( "\n\nRequestEvent Set!!!\n\n" ) ; - this.event = event ; + System.out.println( "\n\nRequestEvent Set!!!\n\n" ); + this.event = event; } @@ -163,11 +162,11 @@ { try { - AbstractSubscriber.inform( this, event ) ; + AbstractSubscriber.inform( this, event ); } catch ( Exception e ) { - fail( "we should be able to inform just fine" ) ; + fail( "we should be able to inform just fine" ); } } Modified: incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/AbstractSubscriberTest.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/AbstractSubscriberTest.java (original) +++ incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/AbstractSubscriberTest.java Sat Sep 11 17:31:18 2004 @@ -14,35 +14,34 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.nio.ByteBuffer ; -import java.util.EventObject ; +import java.nio.ByteBuffer; +import java.util.EventObject; -import org.apache.seda.listener.ClientKey ; +import org.apache.seda.listener.ClientKey; -import junit.framework.TestCase ; +import junit.framework.TestCase; /** * Tests the AbstractSubscriber class. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class AbstractSubscriberTest extends TestCase { - TestSubscriber subscriber = null ; + TestSubscriber subscriber = null; /* * @see TestCase#setUp() */ protected void setUp() throws Exception { - super.setUp() ; - subscriber = new TestSubscriber() ; + super.setUp(); + subscriber = new TestSubscriber(); } @@ -51,8 +50,8 @@ */ protected void tearDown() throws Exception { - super.tearDown() ; - subscriber = null ; + super.tearDown(); + subscriber = null; } @@ -77,11 +76,11 @@ */ public void testInformEventObject() { - EventObject e = new EventSubclass( null, null ) ; - subscriber.inform( e ) ; - subscriber.assertDelivery() ; - subscriber.inform( e ) ; - subscriber.assertDelivery() ; + EventObject e = new EventSubclass( null, null ); + subscriber.inform( e ); + subscriber.assertDelivery(); + subscriber.inform( e ); + subscriber.assertDelivery(); } @@ -97,7 +96,7 @@ { public EventSubclass( ClientKey key, ByteBuffer buf ) { - super( AbstractSubscriberTest.this, key, buf ) ; + super( AbstractSubscriberTest.this, key, buf ); } /* (non-Javadoc) @@ -105,7 +104,7 @@ */ public ByteBuffer claimInterest( Object party ) { - return null ; + return null; } /* (non-Javadoc) @@ -114,24 +113,24 @@ public void releaseInterest( Object party ) { } - } ; + }; class TestSubscriber extends AbstractSubscriber { - InputEvent e = null ; + InputEvent e = null; public void assertDelivery() { - assertNotNull( e ) ; - e = null ; + assertNotNull( e ); + e = null; } public void inform( InputEvent event ) { - assertNotNull( event ) ; - e = event ; + assertNotNull( event ); + e = event; } - } ; + }; } Modified: incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/DefaultStageTest.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/DefaultStageTest.java (original) +++ incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/DefaultStageTest.java Sat Sep 11 17:31:18 2004 @@ -14,32 +14,31 @@ * limitations under the License. * */ -package org.apache.seda.event ; +package org.apache.seda.event; -import java.util.ArrayList ; -import java.util.EventObject ; +import java.util.ArrayList; +import java.util.EventObject; -import org.apache.seda.thread.ThreadPool ; +import org.apache.seda.thread.ThreadPool; import org.apache.seda.stage.*; -import junit.framework.TestCase ; +import junit.framework.TestCase; /** * Tests the DefaultStage class. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultStageTest extends TestCase { - DefaultStage stage = null ; - ThreadPool pool = null ; - DefaultStageConfig config = null ; - StageHandler handler = null ; - ArrayList events = null ; + DefaultStage stage = null; + ThreadPool pool = null; + DefaultStageConfig config = null; + StageHandler handler = null; + ArrayList events = null; /* (non-Javadoc) @@ -50,12 +49,12 @@ // @todo Auto-generated method stub super.tearDown(); - events = null ; - handler = null ; - config = null ; - pool = null ; - stage.stop() ; - stage = null ; + events = null; + handler = null; + config = null; + pool = null; + stage.stop(); + stage = null; } @@ -64,7 +63,7 @@ */ protected void setUp() throws Exception { - super.setUp() ; + super.setUp(); pool = new ThreadPool() { @@ -73,25 +72,25 @@ */ public void execute( Runnable runnable ) { - runnable.run() ; + runnable.run(); } }; - events = new ArrayList() ; + events = new ArrayList(); handler = new StageHandler() { public void handleEvent( EventObject event ) { - events.add( event ) ; + events.add( event ); } - } ; + }; - config = new DefaultStageConfig( "test", pool ) ; - config.setHandler( handler ) ; - stage = new DefaultStage( config ) ; - stage.setMonitor( new LoggingStageMonitor(stage.getClass()) ) ; - stage.start() ; + config = new DefaultStageConfig( "test", pool ); + config.setHandler( handler ); + stage = new DefaultStage( config ); + stage.setMonitor( new LoggingStageMonitor(stage.getClass()) ); + stage.start(); } @@ -101,13 +100,13 @@ { public boolean accept( EventObject event ) { - return true ; + return true; } - } ) ; + } ); - stage.enqueue( new EventObject( this ) ) ; - stage.stop() ; - assertEquals( 1, events.size() ) ; + stage.enqueue( new EventObject( this ) ); + stage.stop(); + assertEquals( 1, events.size() ); } @@ -117,19 +116,19 @@ { public boolean accept( EventObject event ) { - return false ; + return false; } - } ) ; + } ); - stage.enqueue( new EventObject( this ) ) ; - stage.stop() ; - assertEquals( 0, events.size() ) ; + stage.enqueue( new EventObject( this ) ); + stage.stop(); + assertEquals( 0, events.size() ); } public void testGetConfig() { - assertEquals( config, stage.getConfig() ) ; + assertEquals( config, stage.getConfig() ); } Modified: incubator/directory/seda/trunk/impl/src/test/org/apache/seda/listener/DefaultListenerManagerTest.java ============================================================================== --- incubator/directory/seda/trunk/impl/src/test/org/apache/seda/listener/DefaultListenerManagerTest.java (original) +++ incubator/directory/seda/trunk/impl/src/test/org/apache/seda/listener/DefaultListenerManagerTest.java Sat Sep 11 17:31:18 2004 @@ -14,29 +14,28 @@ * limitations under the License. * */ -package org.apache.seda.listener ; +package org.apache.seda.listener; -import org.apache.seda.event.EventRouter ; -import org.apache.seda.event.DefaultEventRouter ; +import org.apache.seda.event.EventRouter; +import org.apache.seda.event.DefaultEventRouter; import org.apache.seda.protocol.InetServiceEntry; -import junit.framework.TestCase ; +import junit.framework.TestCase; /** * Tests the default ListenerManager's operations. * - * @author <a href="mailto:[EMAIL PROTECTED]"> - * Apache Directory Project</a> + * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a> * @version $Rev$ */ public class DefaultListenerManagerTest extends TestCase { /** An event router to use for testing */ - private EventRouter router = null ; + private EventRouter router = null; /** the defualt ListenerManager to test */ - private DefaultListenerManager listener = null ; + private DefaultListenerManager listener = null; @@ -45,11 +44,11 @@ */ protected void setUp() throws Exception { - super.setUp() ; + super.setUp(); - router = new DefaultEventRouter() ; - listener = new DefaultListenerManager( router ) ; - listener.start() ; + router = new DefaultEventRouter(); + listener = new DefaultListenerManager( router ); + listener.start(); } @@ -58,11 +57,11 @@ */ protected void tearDown() throws Exception { - super.tearDown() ; + super.tearDown(); - router = null ; - listener.stop() ; - listener = null ; + router = null; + listener.stop(); + listener = null; } @@ -72,7 +71,7 @@ */ public DefaultListenerManagerTest( String arg0 ) { - super( arg0 ) ; + super( arg0 ); } @@ -88,7 +87,7 @@ ListenerConfig sl = new DefaultListenerConfig( new byte[] { 127,0,0,1}, 50, false, new InetServiceEntry( "ldap", 10389 ) ); - listener.bind( sl ) ; - listener.unbind( sl ) ; + listener.bind( sl ); + listener.unbind( sl ); } }
