[jboss-remoting-commits] JBoss Remoting SVN: r3483 - in remoting3/trunk: api/src/main/java/org/jboss/cx/remoting/spi/protocol and 14 other directories.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Feb 22 11:55:57 EST 2008


Author: david.lloyd at jboss.com
Date: 2008-02-22 11:55:56 -0500 (Fri, 22 Feb 2008)
New Revision: 3483

Added:
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AbstractTypeMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeHashMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeKey.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/Base64DecodingException.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteInput.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteOutput.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/DelegateIterable.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/HashTypeMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/IoUtil.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/LinkedHashTypeMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageInput.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageOutput.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedCollection.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedIterator.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedQueue.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedSet.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/TypeMap.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/UnmodifiableArrayList.java
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/WeakHashSet.java
Removed:
   remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/
Modified:
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ServiceDeploymentSpec.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandlerFactory.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamContext.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamSerializer.java
   remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpointProvider.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/LocalProtocol.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java
   remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ProgressStreamStreamSerializerFactory.java
   remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/ServerInstance.java
   remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java
   remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSessionImpl.java
   remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractHttpMessage.java
   remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractOutgoingHttpMessage.java
   remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/IncomingHttpMessage.java
   remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/OutgoingHttpMessage.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteInput.java
   remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteOutput.java
   remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java
   remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java
   remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java
   remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java
   remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java
Log:
Move classes from org.jboss.cx.remoting.core.util -> org.jboss.cx.remoting.util

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/CommonKeys.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -3,8 +3,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import org.jboss.cx.remoting.core.util.AttributeKey;
-import static org.jboss.cx.remoting.core.util.AttributeKey.key;
+import org.jboss.cx.remoting.util.AttributeKey;
+import static org.jboss.cx.remoting.util.AttributeKey.key;
 
 import javax.security.auth.callback.CallbackHandler;
 

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,7 +2,7 @@
 
 import java.net.URI;
 import java.util.concurrent.ConcurrentMap;
-import org.jboss.cx.remoting.core.util.AttributeMap;
+import org.jboss.cx.remoting.util.AttributeMap;
 import org.jboss.cx.remoting.spi.Discovery;
 import org.jboss.cx.remoting.spi.Registration;
 import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ServiceDeploymentSpec.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ServiceDeploymentSpec.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ServiceDeploymentSpec.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,7 +2,7 @@
 
 import java.util.Collections;
 import java.util.List;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.spi.InterceptorSpec;
 
 /**

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -4,10 +4,10 @@
 import java.util.concurrent.Executor;
 import org.jboss.cx.remoting.RemoteExecutionException;
 import org.jboss.cx.remoting.ServiceLocator;
-import org.jboss.cx.remoting.core.util.ByteInput;
-import org.jboss.cx.remoting.core.util.ByteOutput;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.ByteInput;
+import org.jboss.cx.remoting.util.ByteOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 
 /**
  *

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -6,7 +6,7 @@
 import java.util.concurrent.Executor;
 import org.jboss.cx.remoting.RemoteExecutionException;
 import org.jboss.cx.remoting.ServiceLocator;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageOutput;
 
 /**
  * A protocol handler.
@@ -141,9 +141,9 @@
 
     /**
      * Send data over a stream.  Returns a message output buffer that the message is written into.  When the message
-     * is fully written, the {@link org.jboss.cx.remoting.core.util.MessageOutput#commit()} method will be called to perform the transmission.  The
+     * is fully written, the {@link org.jboss.cx.remoting.util.MessageOutput#commit()} method will be called to perform the transmission.  The
      * supplied executor should be passed in to
-     * {@link org.jboss.cx.remoting.spi.protocol.ProtocolContext#getMessageOutput(org.jboss.cx.remoting.core.util.ByteOutput, java.util.concurrent.Executor)},
+     * {@link org.jboss.cx.remoting.spi.protocol.ProtocolContext#getMessageOutput(org.jboss.cx.remoting.util.ByteOutput, java.util.concurrent.Executor)},
      * if that method is used for serialization.
      *
      * @param streamIdentifier the stream to send data on

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandlerFactory.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandlerFactory.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandlerFactory.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,7 +2,7 @@
 
 import java.io.IOException;
 import java.net.URI;
-import org.jboss.cx.remoting.core.util.AttributeMap;
+import org.jboss.cx.remoting.util.AttributeMap;
 
 /**
  *

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamContext.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamContext.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamContext.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,7 +2,7 @@
 
 import java.io.Closeable;
 import java.io.IOException;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageOutput;
 
 /**
  *

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamSerializer.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamSerializer.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/stream/StreamSerializer.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -1,7 +1,7 @@
 package org.jboss.cx.remoting.spi.stream;
 
 import java.io.IOException;
-import org.jboss.cx.remoting.core.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageInput;
 
 /**
  *

Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -8,7 +8,7 @@
 import org.jboss.cx.remoting.RemotingException;
 import org.jboss.cx.remoting.ServiceDeploymentSpec;
 import org.jboss.cx.remoting.Session;
-import org.jboss.cx.remoting.core.util.AttributeMap;
+import org.jboss.cx.remoting.util.AttributeMap;
 import org.jboss.cx.remoting.spi.Discovery;
 import org.jboss.cx.remoting.spi.Registration;
 import org.jboss.cx.remoting.spi.protocol.ProtocolRegistration;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -19,11 +19,11 @@
 import org.jboss.cx.remoting.ServiceDeploymentSpec;
 import org.jboss.cx.remoting.ServiceLocator;
 import org.jboss.cx.remoting.Session;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.version.Version;
 import org.jboss.cx.remoting.log.Logger;
-import org.jboss.cx.remoting.core.util.AtomicStateMachine;
-import org.jboss.cx.remoting.core.util.AttributeMap;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.AttributeMap;
 import org.jboss.cx.remoting.spi.Discovery;
 import org.jboss.cx.remoting.spi.Registration;
 import org.jboss.cx.remoting.spi.protocol.ProtocolContext;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpointProvider.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpointProvider.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpointProvider.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -4,7 +4,7 @@
 import java.util.Set;
 import org.jboss.cx.remoting.Endpoint;
 import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.spi.EndpointProvider;
 
 /**

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -5,7 +5,7 @@
 import org.jboss.cx.remoting.RemoteExecutionException;
 import org.jboss.cx.remoting.RemotingException;
 import org.jboss.cx.remoting.RequestListener;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.spi.ServerInterceptorFactory;
 import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
 import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -5,7 +5,7 @@
 import org.jboss.cx.remoting.RequestCancelHandler;
 import org.jboss.cx.remoting.RequestContext;
 import org.jboss.cx.remoting.RequestListener;
-import org.jboss.cx.remoting.core.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
 

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -7,8 +7,8 @@
 import org.jboss.cx.remoting.RemoteExecutionException;
 import org.jboss.cx.remoting.RemotingException;
 import org.jboss.cx.remoting.RequestCompletionHandler;
-import org.jboss.cx.remoting.core.util.AtomicStateMachine;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
 import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -10,7 +10,7 @@
 import org.jboss.cx.remoting.IndeterminateOutcomeException;
 import org.jboss.cx.remoting.RemoteExecutionException;
 import org.jboss.cx.remoting.RequestCompletionHandler;
-import org.jboss.cx.remoting.core.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
 

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -5,8 +5,8 @@
 import org.jboss.cx.remoting.ContextSource;
 import org.jboss.cx.remoting.RemotingException;
 import org.jboss.cx.remoting.ServiceLocator;
-import org.jboss.cx.remoting.core.util.AtomicStateMachine;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.ClientInterceptorFactory;
 import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -21,13 +21,13 @@
 import org.jboss.cx.remoting.ServiceLocator;
 import org.jboss.cx.remoting.Session;
 import org.jboss.cx.remoting.core.stream.DefaultStreamDetector;
-import org.jboss.cx.remoting.core.util.AtomicStateMachine;
-import org.jboss.cx.remoting.core.util.AttributeMap;
-import org.jboss.cx.remoting.core.util.ByteInput;
-import org.jboss.cx.remoting.core.util.ByteOutput;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.AttributeMap;
+import org.jboss.cx.remoting.util.ByteInput;
+import org.jboss.cx.remoting.util.ByteOutput;
+import org.jboss.cx.remoting.util.CollectionUtil;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
 import org.jboss.cx.remoting.spi.protocol.ProtocolContext;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreStream.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,8 +2,8 @@
 
 import java.io.IOException;
 import java.util.concurrent.Executor;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
 import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/LocalProtocol.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/LocalProtocol.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/LocalProtocol.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -10,10 +10,10 @@
 import org.jboss.cx.remoting.RemoteExecutionException;
 import org.jboss.cx.remoting.RemotingException;
 import org.jboss.cx.remoting.ServiceLocator;
-import org.jboss.cx.remoting.core.util.AttributeMap;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageOutput;
+import org.jboss.cx.remoting.util.AttributeMap;
+import org.jboss.cx.remoting.util.CollectionUtil;
+import org.jboss.cx.remoting.util.MessageInput;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
 import org.jboss.cx.remoting.spi.protocol.ProtocolContext;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/InputStreamStreamSerializerFactory.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -3,8 +3,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.LinkedList;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
 import org.jboss.cx.remoting.spi.stream.StreamContext;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/IteratorStreamSerializerFactory.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,7 +2,7 @@
 
 import java.io.IOException;
 import java.util.Iterator;
-import org.jboss.cx.remoting.core.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageInput;
 import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
 import org.jboss.cx.remoting.spi.stream.StreamContext;
 import org.jboss.cx.remoting.spi.stream.StreamSerializer;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSinkStreamSerializerFactory.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -1,8 +1,8 @@
 package org.jboss.cx.remoting.core.stream;
 
 import java.io.IOException;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
 import org.jboss.cx.remoting.spi.stream.StreamContext;
 import org.jboss.cx.remoting.spi.stream.StreamSerializer;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ObjectSourceStreamSerializerFactory.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -4,8 +4,8 @@
 import java.util.LinkedList;
 import java.util.NoSuchElementException;
 import java.util.Queue;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
 import org.jboss.cx.remoting.spi.stream.StreamContext;
 import org.jboss.cx.remoting.spi.stream.StreamSerializer;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/OutputStreamStreamSerailizerFactory.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,8 +2,8 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
 import org.jboss.cx.remoting.spi.stream.StreamContext;
 import org.jboss.cx.remoting.spi.stream.StreamSerializer;

Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ProgressStreamStreamSerializerFactory.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ProgressStreamStreamSerializerFactory.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/stream/ProgressStreamStreamSerializerFactory.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -1,8 +1,8 @@
 package org.jboss.cx.remoting.core.stream;
 
 import java.io.IOException;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageOutput;
 import org.jboss.cx.remoting.spi.stream.RemoteStreamSerializer;
 import org.jboss.cx.remoting.spi.stream.StreamContext;
 import org.jboss.cx.remoting.spi.stream.StreamSerializer;

Modified: remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java
===================================================================
--- remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/HttpProtocolSupport.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -6,8 +6,8 @@
 import java.util.Random;
 import org.jboss.cx.remoting.Endpoint;
 import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
-import org.jboss.cx.remoting.core.util.AttributeMap;
+import org.jboss.cx.remoting.util.CollectionUtil;
+import org.jboss.cx.remoting.util.AttributeMap;
 import org.jboss.cx.remoting.http.spi.RemotingHttpServerContext;
 import org.jboss.cx.remoting.http.spi.RemotingHttpSessionContext;
 import org.jboss.cx.remoting.http.spi.HttpTransporter;

Modified: remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSessionImpl.java
===================================================================
--- remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSessionImpl.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSessionImpl.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -5,9 +5,9 @@
 import org.jboss.cx.remoting.http.spi.ReadyNotifier;
 import org.jboss.cx.remoting.http.spi.OutgoingHttpMessage;
 import org.jboss.cx.remoting.http.spi.AbstractOutgoingHttpMessage;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
-import org.jboss.cx.remoting.core.util.MessageOutput;
-import org.jboss.cx.remoting.core.util.ByteOutput;
+import org.jboss.cx.remoting.util.CollectionUtil;
+import org.jboss.cx.remoting.util.MessageOutput;
+import org.jboss.cx.remoting.util.ByteOutput;
 import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
 import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
 import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;

Modified: remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractHttpMessage.java
===================================================================
--- remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractHttpMessage.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractHttpMessage.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -3,7 +3,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Collections;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.CollectionUtil;
 
 /**
  *

Modified: remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractOutgoingHttpMessage.java
===================================================================
--- remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractOutgoingHttpMessage.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/AbstractOutgoingHttpMessage.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -1,11 +1,5 @@
 package org.jboss.cx.remoting.http.spi;
 
-import org.jboss.cx.remoting.core.util.ByteOutput;
-import java.io.IOException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
 /**
  *
  */

Modified: remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/IncomingHttpMessage.java
===================================================================
--- remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/IncomingHttpMessage.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/IncomingHttpMessage.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,7 +2,7 @@
 
 import java.io.IOException;
 import java.net.InetAddress;
-import org.jboss.cx.remoting.core.util.ByteInput;
+import org.jboss.cx.remoting.util.ByteInput;
 
 /**
  *

Modified: remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/OutgoingHttpMessage.java
===================================================================
--- remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/OutgoingHttpMessage.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/spi/OutgoingHttpMessage.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -1,7 +1,7 @@
 package org.jboss.cx.remoting.http.spi;
 
 import java.io.IOException;
-import org.jboss.cx.remoting.core.util.ByteOutput;
+import org.jboss.cx.remoting.util.ByteOutput;
 
 /**
  *

Modified: remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/ServerInstance.java
===================================================================
--- remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/ServerInstance.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/http-se6/src/main/java/org/jboss/cx/remoting/http/se6/ServerInstance.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -10,8 +10,8 @@
 import org.jboss.cx.remoting.http.spi.RemotingHttpSessionContext;
 import org.jboss.cx.remoting.http.spi.OutgoingHttpMessage;
 import org.jboss.cx.remoting.http.spi.AbstractIncomingHttpMessage;
-import org.jboss.cx.remoting.core.util.ByteInput;
-import org.jboss.cx.remoting.core.util.ByteOutput;
+import org.jboss.cx.remoting.util.ByteInput;
+import org.jboss.cx.remoting.util.ByteOutput;
 
 import com.sun.net.httpserver.BasicAuthenticator;
 import com.sun.net.httpserver.Headers;

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -21,11 +21,11 @@
 import org.jboss.cx.remoting.CommonKeys;
 import org.jboss.cx.remoting.RemoteExecutionException;
 import org.jboss.cx.remoting.ServiceLocator;
-import org.jboss.cx.remoting.core.util.AtomicStateMachine;
-import org.jboss.cx.remoting.core.util.AttributeMap;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
-import org.jboss.cx.remoting.core.util.MessageInput;
-import org.jboss.cx.remoting.core.util.MessageOutput;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.AttributeMap;
+import org.jboss.cx.remoting.util.MessageOutput;
+import org.jboss.cx.remoting.util.MessageInput;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.jrpp.id.IdentifierManager;
 import org.jboss.cx.remoting.jrpp.id.JrppContextIdentifier;
 import org.jboss.cx.remoting.jrpp.id.JrppRequestIdentifier;

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppProtocolSupport.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -20,7 +20,7 @@
 import org.apache.mina.transport.socket.nio.NioSocketConnector;
 import org.jboss.cx.remoting.Endpoint;
 import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.core.util.AttributeMap;
+import org.jboss.cx.remoting.util.AttributeMap;
 import org.jboss.cx.remoting.jrpp.mina.FramingIoFilter;
 import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
 import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppServer.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -14,7 +14,7 @@
 import org.apache.mina.handler.multiton.SingleSessionIoHandlerDelegate;
 import org.apache.mina.handler.multiton.SingleSessionIoHandlerFactory;
 import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
-import org.jboss.cx.remoting.core.util.AttributeMap;
+import org.jboss.cx.remoting.util.AttributeMap;
 import org.jboss.cx.remoting.jrpp.mina.FramingIoFilter;
 import org.jboss.cx.remoting.spi.protocol.ProtocolServerContext;
 

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppRequestIdentifier.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -1,7 +1,7 @@
 package org.jboss.cx.remoting.jrpp.id;
 
 import java.io.IOException;
-import org.jboss.cx.remoting.core.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageInput;
 import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
 
 /**

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppServiceIdentifier.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -1,7 +1,7 @@
 package org.jboss.cx.remoting.jrpp.id;
 
 import java.io.IOException;
-import org.jboss.cx.remoting.core.util.MessageInput;
+import org.jboss.cx.remoting.util.MessageInput;
 import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
 
 /**

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteInput.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteInput.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteInput.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -2,7 +2,7 @@
 
 import java.io.IOException;
 import org.apache.mina.common.IoBuffer;
-import org.jboss.cx.remoting.core.util.ByteInput;
+import org.jboss.cx.remoting.util.ByteInput;
 
 /**
  *

Modified: remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteOutput.java
===================================================================
--- remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteOutput.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/mina/IoBufferByteOutput.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -3,7 +3,7 @@
 import java.io.IOException;
 import org.apache.mina.common.IoBuffer;
 import org.apache.mina.common.IoSession;
-import org.jboss.cx.remoting.core.util.ByteOutput;
+import org.jboss.cx.remoting.util.ByteOutput;
 
 /**
  *

Modified: remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java
===================================================================
--- remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/AbstractSrpSaslParticipant.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -19,7 +19,7 @@
 import java.util.Map;
 import java.util.Random;
 import org.jboss.cx.remoting.core.security.sasl.BufferFactory;
-import org.jboss.cx.remoting.core.util.IoUtil;
+import org.jboss.cx.remoting.util.IoUtil;
 
 import javax.crypto.BadPaddingException;
 import javax.crypto.Cipher;

Modified: remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java
===================================================================
--- remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslClientImpl.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -10,7 +10,7 @@
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.log.Logger;
 
 import javax.crypto.NoSuchPaddingException;

Modified: remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java
===================================================================
--- remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpSaslServerImpl.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -13,8 +13,8 @@
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
-import org.jboss.cx.remoting.core.util.Base64DecodingException;
-import org.jboss.cx.remoting.core.util.CollectionUtil;
+import org.jboss.cx.remoting.util.Base64DecodingException;
+import org.jboss.cx.remoting.util.CollectionUtil;
 import org.jboss.cx.remoting.log.Logger;
 
 import javax.crypto.NoSuchPaddingException;

Modified: remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java
===================================================================
--- remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/srp/src/main/java/org/jboss/cx/remoting/core/security/sasl/SrpVerifier.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -10,8 +10,8 @@
 import java.security.NoSuchAlgorithmException;
 import java.util.Random;
 import java.util.Set;
-import org.jboss.cx.remoting.core.util.Base64DecodingException;
-import org.jboss.cx.remoting.core.util.IoUtil;
+import org.jboss.cx.remoting.util.Base64DecodingException;
+import org.jboss.cx.remoting.util.IoUtil;
 
 /**
  *

Modified: remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java
===================================================================
--- remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java	2008-02-22 16:50:40 UTC (rev 3482)
+++ remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -3,8 +3,8 @@
 import java.io.IOException;
 import java.net.URI;
 import org.jboss.cx.remoting.core.CoreEndpointProvider;
-import org.jboss.cx.remoting.core.util.AttributeHashMap;
-import org.jboss.cx.remoting.core.util.AttributeMap;
+import org.jboss.cx.remoting.util.AttributeHashMap;
+import org.jboss.cx.remoting.util.AttributeMap;
 import org.jboss.cx.remoting.log.Logger;
 import org.jboss.cx.remoting.spi.EndpointProvider;
 import org.jboss.cx.remoting.spi.wrapper.ContextSourceWrapper;

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AbstractTypeMap.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/AbstractTypeMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AbstractTypeMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AbstractTypeMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,231 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public abstract class AbstractTypeMap<B> implements TypeMap<B> {
+    private final ConcurrentMap<Class<? extends B>, B> map;
+    private final Set<Entry<? extends B>> entrySet;
+
+    protected AbstractTypeMap(ConcurrentMap<Class<? extends B>, B> map) {
+        if (map == null) {
+            throw new NullPointerException("map is null");
+        }
+        this.map = map;
+        entrySet = new EntrySet();
+    }
+
+    protected AbstractTypeMap(Map<Class<? extends B>, B> map) {
+        if (map == null) {
+            throw new NullPointerException("map is null");
+        }
+        this.map = new AtomicMap<Class<? extends B>, B>(map);
+        entrySet = new EntrySet();
+    }
+
+    public void clear() {
+        map.clear();
+    }
+
+    public boolean containsKey(final Class<?> key) {
+        return map.containsKey(key);
+    }
+
+    public boolean containsValue(final Object value) {
+        // since we key by type, we can do an O(1) search for value!
+        final Class<? extends Object> claxx = value.getClass();
+        return map.containsKey(claxx) && isEqual(value, map.get(claxx));
+    }
+
+    private static boolean isEqual(final Object a, final Object b) {
+        return (a == null) == (b == null) && (a == null || a.equals(b));
+    }
+
+    public Set<Entry<? extends B>> entrySet() {
+        return entrySet;
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T extends B> T get(final Class<T> key) {
+        return (T) map.get(key);
+    }
+
+    public boolean isEmpty() {
+        return map.isEmpty();
+    }
+
+    public Set<Class<? extends B>> keySet() {
+        return map.keySet();
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T extends B> T put(final Class<T> key, final T value) {
+        return (T) map.put(key, value);
+    }
+
+    public <T extends B> void putAll(final TypeMap<T> m) {
+        for (Entry<? extends T> e : m.entrySet()) {
+            map.put(e.getKey(), e.getValue());
+        }
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T extends B> T remove(final Class<T> key) {
+        return (T) map.remove(key);
+    }
+
+    public int size() {
+        return map.size();
+    }
+
+    public Collection<? extends B> values() {
+        return map.values();
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T extends B> T putIfAbsent(final Class<T> key, final T value) {
+        return (T) map.putIfAbsent(key, value);
+    }
+
+    public <T extends B> boolean remove(final Class<T> key, final Object value) {
+        return map.remove(key, value);
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T extends B> T replace(final Class<T> key, final T value) {
+        return (T) map.replace(key, value);
+    }
+
+    public <T extends B> boolean replace(final Class<T> key, final T oldValue, final T newValue) {
+        return map.replace(key, oldValue, newValue);
+    }
+
+    private final class EntrySet implements Set<Entry<? extends B>> {
+        private final Set<Map.Entry<Class<? extends B>,B>> entries = map.entrySet();
+
+        private EntrySet() {
+        }
+
+        public int size() {
+            return entries.size();
+        }
+
+        public boolean isEmpty() {
+            return entries.isEmpty();
+        }
+
+        public boolean contains(final Object o) {
+            // containsValue(T)==true implies containsKey(T.class)==true
+            return o instanceof Entry && map.containsValue(((Entry<?>) o).getValue());
+        }
+
+        public Iterator<Entry<? extends B>> iterator() {
+            return new EntryIterator();
+        }
+
+        public Object[] toArray() {
+            throw new UnsupportedOperationException("toArray() not allowed");
+        }
+
+        public <T> T[] toArray(final T[] a) {
+            throw new UnsupportedOperationException("toArray() not allowed");
+        }
+
+        public boolean add(final Entry<? extends B> o) {
+            throw new UnsupportedOperationException("add() not allowed");
+        }
+
+        @SuppressWarnings ({"unchecked"})
+        public boolean remove(final Object o) {
+            if (! (o instanceof Entry)) {
+                return false;
+            }
+            Class<? extends B> key = ((Entry<? extends B>)o).getKey();
+            final Object value = ((Entry<? extends B>) o).getValue();
+            return AbstractTypeMap.this.remove(key, value);
+        }
+
+        public boolean containsAll(final Collection<?> c) {
+            for (Object x : c) {
+                if (! contains(x)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+
+        public boolean addAll(final Collection<? extends Entry<? extends B>> c) {
+            throw new UnsupportedOperationException("addAll() not allowed");
+        }
+
+        public boolean retainAll(final Collection<?> c) {
+            throw new UnsupportedOperationException("retainAll() not allowed");
+        }
+
+        public boolean removeAll(final Collection<?> c) {
+            throw new UnsupportedOperationException("removeAll() not allowed");
+        }
+
+        public void clear() {
+            map.clear();
+        }
+    }
+
+    private final class EntryIterator implements Iterator<Entry<? extends B>> {
+        private final Iterator<Map.Entry<Class<? extends B>,B>> iterator = map.entrySet().iterator();
+
+        private EntryIterator() {}
+
+        public boolean hasNext() {
+            return iterator.hasNext();
+        }
+
+        @SuppressWarnings ({"unchecked"})
+        public Entry<? extends B> next() {
+            return new EntryImpl(iterator.next());
+        }
+
+        public void remove() {
+            iterator.remove();
+        }
+    }
+
+    private final class EntryImpl<Z> implements Entry<Z> {
+        private final Map.Entry<Class<Z>, Z> entry;
+
+        public EntryImpl(final Map.Entry<Class<Z>, Z> entry) {
+            this.entry = entry;
+        }
+
+        public Class<Z> getKey() {
+            return entry.getKey();
+        }
+
+        public Z getValue() {
+            return entry.getValue();
+        }
+
+        public Z setValue(final Z value) {
+            return entry.setValue(value);
+        }
+
+        public boolean equals(Object obj) {
+            if (obj instanceof Entry) {
+                Entry<?> other = (Entry<?>) obj;
+                return isEqual(other.getKey(), entry.getKey()) && isEqual(other.getValue(), entry.getValue());
+            } else {
+                return false;
+            }
+        }
+
+        public int hashCode() {
+            return entry.hashCode();
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicMap.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/AtomicMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,107 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public final class AtomicMap<K, V> implements ConcurrentMap<K, V> {
+    private final Map<K, V> delegate;
+
+    public AtomicMap(final Map<K, V> delegate) {
+        this.delegate = delegate;
+    }
+
+    public int size() {
+        return delegate.size();
+    }
+
+    public boolean isEmpty() {
+        return delegate.isEmpty();
+    }
+
+    public boolean containsKey(final Object key) {
+        return delegate.containsKey(key);
+    }
+
+    public boolean containsValue(final Object value) {
+        return delegate.containsValue(value);
+    }
+
+    public V get(final Object key) {
+        return delegate.get(key);
+    }
+
+    public V put(final K key, final V value) {
+        return delegate.put(key, value);
+    }
+
+    public V remove(final Object key) {
+        return delegate.remove(key);
+    }
+
+    public void putAll(final Map<? extends K, ? extends V> t) {
+        delegate.putAll(t);
+    }
+
+    public void clear() {
+        delegate.clear();
+    }
+
+    public Set<K> keySet() {
+        return delegate.keySet();
+    }
+
+    public Collection<V> values() {
+        return delegate.values();
+    }
+
+    public Set<Entry<K, V>> entrySet() {
+        return delegate.entrySet();
+    }
+
+    public boolean equals(final Object o) {
+        return delegate.equals(o);
+    }
+
+    public int hashCode() {
+        return delegate.hashCode();
+    }
+
+    public V putIfAbsent(final K key, final V value) {
+        if (delegate.containsKey(key)) {
+            return delegate.get(key);
+        } else {
+            return delegate.put(key, value);
+        }
+    }
+
+    public boolean remove(final Object key, final Object value) {
+        if (delegate.containsKey(key) && (value == null && delegate.get(key) == null || delegate.get(key).equals(value))) {
+            delegate.remove(key);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public boolean replace(final K key, final V oldValue, final V newValue) {
+        if (delegate.containsKey(key) && (oldValue == null ? delegate.get(key) == null : delegate.get(key).equals(oldValue))) {
+            delegate.put(key, newValue);
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    public V replace(final K key, final V value) {
+        if (delegate.containsKey(key)) {
+            return delegate.put(key, value);
+        } else {
+            return null;
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/AtomicStateMachine.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AtomicStateMachine.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,506 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ *
+ */
+public final class AtomicStateMachine<T extends Enum<T>> {
+    // protected by {@code lock}
+    private T state;
+
+    private final ReadWriteLock lock = new ReentrantReadWriteLock();
+    private final Lock readLock = lock.readLock();
+    private final Lock writeLock = lock.writeLock();
+    private final Condition cond = writeLock.newCondition();
+
+    public static <T extends Enum<T>> AtomicStateMachine<T> start(final T initialState) {
+        return new AtomicStateMachine<T>(initialState);
+    }
+
+    private AtomicStateMachine(final T state) {
+        if (state == null) {
+            throw new NullPointerException("state is null");
+        }
+        this.state = state;
+    }
+
+    public boolean transition(final T state) {
+        writeLock.lock();
+        try {
+            if (state == null) {
+                throw new NullPointerException("state is null");
+            }
+            if (this.state == state) {
+                return false;
+            }
+            this.state = state;
+            cond.signalAll();
+            return true;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    /**
+     * Transition the state, and hold it at the given state until {@link #release()} is called.  Must not be
+     * called if the state is already held from this thread.
+     *
+     * Example:
+     * <pre>
+     *     if (state.transitionHold(State.STOPPING)) try {
+     *         // do stuff
+     *     } finally {
+     *         state.release();
+     *     }
+     * </pre>
+     *
+     * @param state the target state
+     * @return {@code true} if the transition happened
+     */
+    public boolean transitionHold(final T state) {
+        if (state == null) {
+            throw new NullPointerException("state is null");
+        }
+        writeLock.lock();
+        try {
+            if (this.state == state) {
+                return false;
+            }
+            this.state = state;
+            cond.signalAll();
+            readLock.lock();
+            return true;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public boolean transitionExclusive(final T state) {
+        if (state == null) {
+            throw new NullPointerException("state is null");
+        }
+        writeLock.lock();
+        if (this.state == state) {
+            return false;
+        }
+        this.state = state;
+        cond.signalAll();
+        return true;
+    }
+
+    /**
+     * Release a held state.  Must be called from the same thread that is holding the state.
+     */
+    public void release() {
+        readLock.unlock();
+    }
+
+    public void releaseExclusive() {
+        writeLock.unlock();
+    }
+
+    public void releaseDowngrade() {
+        readLock.lock();
+        writeLock.unlock();
+    }
+
+    public boolean transition(final T fromState, final T toState) {
+        if (fromState == null) {
+            throw new NullPointerException("fromState is null");
+        }
+        if (toState == null) {
+            throw new NullPointerException("toState is null");
+        }
+        writeLock.lock();
+        try {
+            if (state != fromState) {
+                return false;
+            }
+            state = toState;
+            cond.signalAll();
+            return true;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public boolean transitionHold(final T fromState, final T toState) {
+        if (fromState == null) {
+            throw new NullPointerException("fromState is null");
+        }
+        if (toState == null) {
+            throw new NullPointerException("toState is null");
+        }
+        writeLock.lock();
+        try {
+            if (state != fromState) {
+                return false;
+            }
+            state = toState;
+            cond.signalAll();
+            readLock.lock();
+            return true;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public boolean transitionExclusive(final T fromState, final T toState) {
+        if (fromState == null) {
+            throw new NullPointerException("fromState is null");
+        }
+        if (toState == null) {
+            throw new NullPointerException("toState is null");
+        }
+        writeLock.lock();
+        boolean ok = false;
+        try {
+            if (state != fromState) {
+                writeLock.unlock();
+                return false;
+            }
+            state = toState;
+            cond.signalAll();
+            ok = true;
+            return true;
+        } finally {
+            if (! ok) {
+                writeLock.unlock();
+            }
+        }
+    }
+
+    public void requireTransition(final T state) {
+        if (! transition(state)) {
+            throw new IllegalStateException("Already in state " + state);
+        }
+    }
+
+    public void requireTransitionHold(final T state) {
+        if (! transitionHold(state)) {
+            throw new IllegalStateException("Already in state " + state);
+        }
+    }
+
+    public void requireTransition(final T fromState, final T toState) {
+        if (! transition(fromState, toState)) {
+            throw new IllegalStateException("Cannot transition from " + fromState + " to " + toState + " (current state is " + state + ")");
+        }
+    }
+
+    public void requireTransitionHold(final T fromState, final T toState) {
+        if (! transitionHold(fromState, toState)) {
+            throw new IllegalStateException("Cannot transition from " + fromState + " to " + toState + " (current state is " + state + ")");
+        }
+    }
+
+    public void requireTransitionExclusive(T fromState, T toState) {
+        if (! transitionExclusive(fromState, toState)) {
+            throw new IllegalStateException("Cannot transition from " + fromState + " to " + toState + " (current state is " + state + ")");
+        }
+    }
+
+
+    public void waitInterruptablyFor(final T state) throws InterruptedException {
+        writeLock.lockInterruptibly();
+        try {
+            while (this.state != state) {
+                cond.await();
+            }
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public void waitFor(final T state) {
+        writeLock.lock();
+        try {
+            while (this.state != state) {
+                cond.awaitUninterruptibly();
+            }
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public void waitForHold(final T state) {
+        writeLock.lock();
+        try {
+            while (this.state != state) {
+                cond.awaitUninterruptibly();
+            }
+            readLock.lock();
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public void waitForAny() {
+        writeLock.lock();
+        try {
+            waitForNot(state);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public boolean waitInterruptablyFor(final T state, final long timeout, final TimeUnit timeUnit) throws InterruptedException {
+        final long timeoutMillis = timeUnit.toMillis(timeout);
+        final long startTime = System.currentTimeMillis();
+        final long endTime = startTime + timeoutMillis < 0 ? Long.MAX_VALUE : startTime + timeoutMillis;
+        final Date deadline = new Date(endTime);
+        writeLock.lockInterruptibly();
+        try {
+            while (this.state != state) {
+                if (! cond.awaitUntil(deadline)) {
+                    return false;
+                }
+            }
+            return true;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public T waitInterruptablyForNot(final T state) throws InterruptedException {
+        writeLock.lockInterruptibly();
+        try {
+            while (this.state == state) {
+                cond.await();
+            }
+            return this.state;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public T waitInterruptablyForNotHold(final T state) throws InterruptedException {
+        writeLock.lockInterruptibly();
+        try {
+            while (this.state == state) {
+                cond.await();
+            }
+            readLock.lockInterruptibly();
+            return this.state;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public T waitForNot(final T state) {
+        writeLock.lock();
+        try {
+            while (this.state == state) {
+                cond.awaitUninterruptibly();
+            }
+            return this.state;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public T waitForNotHold(final T state) {
+        writeLock.lock();
+        try {
+            while (this.state == state) {
+                cond.awaitUninterruptibly();
+            }
+            readLock.lock();
+            return this.state;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public T waitForNotExclusive(final T state) {
+        writeLock.lock();
+        while (this.state == state) {
+            cond.awaitUninterruptibly();
+        }
+        return this.state;
+    }
+
+    public T waitInterruptablyForNot(final T state, final long timeout, final TimeUnit timeUnit) throws InterruptedException {
+        final long timeoutMillis = timeUnit.toMillis(timeout);
+        final long startTime = System.currentTimeMillis();
+        final long endTime = startTime + timeoutMillis < 0 ? Long.MAX_VALUE : startTime + timeoutMillis;
+        final Date deadLine = new Date(endTime);
+        writeLock.lockInterruptibly();
+        try {
+            while (this.state == state) {
+                cond.awaitUntil(deadLine);
+            }
+            return this.state;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+
+    public T waitInterruptablyForNotHold(final T state, final long timeout, final TimeUnit timeUnit) throws InterruptedException {
+        final long timeoutMillis = timeUnit.toMillis(timeout);
+        final long startTime = System.currentTimeMillis();
+        final long endTime = startTime + timeoutMillis < 0 ? Long.MAX_VALUE : startTime + timeoutMillis;
+        final Date deadLine = new Date(endTime);
+        writeLock.lockInterruptibly();
+        try {
+            while (this.state == state) {
+                cond.awaitUntil(deadLine);
+            }
+            readLock.lockInterruptibly();
+            return this.state;
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    public T waitForNot(final T state, final long timeout, final TimeUnit timeUnit) {
+        final long timeoutMillis = timeUnit.toMillis(timeout);
+        final long startTime = System.currentTimeMillis();
+        final long endTime = startTime + timeoutMillis < 0 ? Long.MAX_VALUE : startTime + timeoutMillis;
+        final Date deadLine = new Date(endTime);
+        boolean intr = false;
+        writeLock.lock();
+        try {
+            while (this.state == state) {
+                try {
+                    if (! cond.awaitUntil(deadLine)) {
+                        break;
+                    }
+                } catch (InterruptedException e) {
+                    intr = true;
+                }
+            }
+            return this.state;
+        } finally {
+            if (intr) {
+                Thread.currentThread().interrupt();
+            }
+        }
+    }
+
+    public T getState() {
+        readLock.lock();
+        try {
+            return state;
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    public T getStateHold() {
+        readLock.lock();
+        return state;
+    }
+
+    public T getStateExclusive() {
+        writeLock.lock();
+        return state;
+    }
+
+    public boolean inHoldExclusive(T... states) {
+        if (states == null) {
+            throw new NullPointerException("states is null");
+        }
+        writeLock.lock();
+        for (T state : states) {
+            if (this.state == state) {
+                return true;
+            }
+        }
+        writeLock.unlock();
+        return false;
+    }
+
+    public boolean inHold(T... states) {
+        if (states == null) {
+            throw new NullPointerException("states is null");
+        }
+        readLock.lock();
+        for (T state : states) {
+            if (this.state == state) {
+                return true;
+            }
+        }
+        readLock.unlock();
+        return false;
+    }
+
+    public boolean in(T... states) {
+        if (states == null) {
+            throw new NullPointerException("states is null");
+        }
+        readLock.lock();
+        try {
+            for (T state : states) {
+                if (this.state == state) {
+                    return true;
+                }
+            }
+            return false;
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    public void require(T state) {
+        if (state == null) {
+            throw new NullPointerException("state is null");
+        }
+        readLock.lock();
+        try {
+            if (this.state != state) {
+                throw new IllegalStateException("Invalid state (expected " + state + ", but current state is " + this.state + ")");
+            }
+        } finally {
+            readLock.unlock();
+        }
+    }
+
+    public void requireHold(T state) {
+        if (state == null) {
+            throw new NullPointerException("state is null");
+        }
+        boolean ok = false;
+        readLock.lock();
+        try {
+            if (this.state != state) {
+                throw new IllegalStateException("Invalid state (expected " + state + ", but current state is " + this.state + ")");
+            }
+            ok = true;
+        } finally {
+            if (! ok) readLock.unlock();
+        }
+    }
+
+    public void requireExclusive(T state) {
+        if (state == null) {
+            throw new NullPointerException("state is null");
+        }
+        boolean ok = false;
+        writeLock.lock();
+        try {
+            if (this.state != state) {
+                throw new IllegalStateException("Invalid state (expected " + state + ", but current state is " + this.state + ")");
+            }
+            ok = true;
+        } finally {
+            if (! ok) writeLock.unlock();
+        }
+    }
+
+    public String toString() {
+        readLock.lock();
+        try {
+            return "State = " + state;
+        } finally {
+            readLock.unlock();
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeHashMap.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/AttributeHashMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeHashMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeHashMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,105 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public final class AttributeHashMap implements AttributeMap {
+    private final ConcurrentMap<AttributeKey<?>, Object> map = CollectionUtil.concurrentMap();
+
+    @SuppressWarnings ({"unchecked"})
+    public <T> T get(AttributeKey<T> key) {
+        return (T) map.get(key);
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T> T put(AttributeKey<T> key, T value) {
+        return (T) map.put(key, value);
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T> T remove(AttributeKey<T> key) {
+        return (T) map.remove(key);
+    }
+
+    public <T> boolean remove(AttributeKey<T> key, T value) {
+        return map.remove(key, value);
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public <T> T putIfAbsent(AttributeKey<T> key, T value) {
+        return (T) map.putIfAbsent(key, value);
+    }
+
+    public <T> boolean replace(AttributeKey<T> key, T oldValue, T newValue) {
+        return map.replace(key, oldValue, newValue);
+    }
+
+    public <T> boolean containsKey(AttributeKey<T> key) {
+        return map.containsKey(key);
+    }
+
+    public <T> boolean containsValue(T value) {
+        return map.containsValue(value);
+    }
+
+    public Iterable<Entry<?>> entries() {
+        return new Iterable<Entry<?>>() {
+            public Iterator<Entry<?>> iterator() {
+                final Iterator<Map.Entry<AttributeKey<?>, Object>> i = map.entrySet().iterator();
+                return new Iterator<Entry<?>>() {
+                    public boolean hasNext() {
+                        return i.hasNext();
+                    }
+
+                    public Entry<?> next() {
+                        final Map.Entry<AttributeKey<?>, Object> ie = i.next();
+                        return new Entry<Object>() {
+                            @SuppressWarnings ({"unchecked"})
+                            public AttributeKey<Object> getKey() {
+                                return (AttributeKey<Object>) ie.getKey();
+                            }
+
+                            public Object getValue() {
+                                return ie.getValue();
+                            }
+
+                            public void setValue(final Object newValue) {
+                                ie.setValue(newValue);
+                            }
+                        };
+                    }
+
+                    public void remove() {
+                        i.remove();
+                    }
+                };
+            }
+        };
+    }
+
+    public Set<AttributeKey<?>> keySet() {
+        return map.keySet();
+    }
+
+    public Collection<?> values() {
+        return map.values();
+    }
+
+    public boolean isEmpty() {
+        return map.isEmpty();
+    }
+
+    public int size() {
+        return map.size();
+    }
+
+    public void clear() {
+        map.clear();
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeKey.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/AttributeKey.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeKey.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeKey.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,20 @@
+package org.jboss.cx.remoting.util;
+
+/**
+ *
+ */
+public final class AttributeKey<T> {
+    private final String name;
+
+    public static <T> AttributeKey<T> key(String name) {
+        return new AttributeKey<T>(name);
+    }
+
+    public AttributeKey(final String name) {
+        this.name = name;
+    }
+
+    public String toString() {
+        return "Key \"" + name + "\"";
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeMap.java (from rev 3482, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/AttributeMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/AttributeMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,145 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * A map whose value types are determined by the key.
+ */
+public interface AttributeMap {
+
+    /**
+     * Get a value from the map.
+     *
+     * @param key the key
+     * @return the value
+     */
+    <T> T get(AttributeKey<T> key);
+
+    /**
+     * Store a value into the map.  Any previous mapping for this value is overwritten.
+     *
+     * @param key the key
+     * @param value the new value
+     * @return the old value (may be {@code null}), or {@code null} if there was no mapping for this key
+     */
+    <T> T put(AttributeKey<T> key, T value);
+
+    /**
+     * Remove a mapping from the map.
+     *
+     * @param key the key
+     * @return the old value (may be {@code null}), or {@code null} if there was no mapping for this key
+     */
+    <T> T remove(AttributeKey<T> key);
+
+    /**
+     * Remove a mapping from the map.  Both the key and value must match the values given.
+     *
+     * @param key the key
+     * @param value the value
+     * @return {@code true} if a matching mapping was located and removed
+     */
+    <T> boolean remove(AttributeKey<T> key, T value);
+
+    /**
+     * Store a value into the map if there is no value currently stored.
+     *
+     * @param key the key
+     * @param value the value
+     * @return the old value if there was a previous mapping
+     */
+    <T> T putIfAbsent(AttributeKey<T> key, T value);
+
+    /**
+     * Replace a mapping in the map.
+     *
+     * @param key the key
+     * @param oldValue the old value
+     * @param newValue the replacement value
+     * @return {@code true} if a matching mapping was located and replaced
+     */
+    <T> boolean replace(AttributeKey<T> key, T oldValue, T newValue);
+
+    /**
+     * Test the map for the presence of a key.
+     *
+     * @param key the key
+     * @return {@code true} if the key is present in the map
+     */
+    <T> boolean containsKey(AttributeKey<T> key);
+
+    /**
+     * Test the map for the presence of a value.
+     *
+     * @param value the value
+     * @return {@code true} if the value is present in the map
+     */
+    <T> boolean containsValue(T value);
+
+    /**
+     * Get all the map entries.
+     *
+     * @return the entries
+     */
+    Iterable<Entry<?>> entries();
+
+    /**
+     * Get the key set for this map.  The returned set supports all set operations except for {@code add} and {@code addAll}.
+     *
+     * @return the key set
+     */
+    Set<AttributeKey<?>> keySet();
+
+    /**
+     * Get the collection of values for this map.
+     *
+     * @return the values
+     */
+    Collection<?> values();
+
+    /**
+     * Determine whether this map is empty.
+     *
+     * @return {@code true} if the map has no mappings
+     */
+    boolean isEmpty();
+
+    /**
+     * Determine the number of entries in the map.
+     *
+     * @return the number of entries
+     */
+    int size();
+
+    /**
+     * Clear the map of all mappings.
+     */
+    void clear();
+
+    /**
+     * An entry in the {@code AttributeMap}.
+     */
+    interface Entry<T> {
+        /**
+         * Get the entry key.
+         *
+         * @return the key
+         */
+        AttributeKey<T> getKey();
+
+        /**
+         * Get the entry value.
+         *
+         * @return the value
+         */
+        T getValue();
+
+        /**
+         * Change the entry value.
+         *
+         * @param newValue the new value
+         */
+        void setValue(T newValue);
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/Base64DecodingException.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/Base64DecodingException.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/Base64DecodingException.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/Base64DecodingException.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,21 @@
+package org.jboss.cx.remoting.util;
+
+/**
+ *
+ */
+public final class Base64DecodingException extends Exception {
+    public Base64DecodingException() {
+    }
+
+    public Base64DecodingException(String message) {
+        super(message);
+    }
+
+    public Base64DecodingException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public Base64DecodingException(Throwable cause) {
+        super(cause);
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteInput.java (from rev 3482, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/ByteInput.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteInput.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteInput.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,44 @@
+package org.jboss.cx.remoting.util;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * A readable source of byte data.
+ */
+public interface ByteInput extends Closeable {
+    /**
+     * Read one byte.
+     *
+     * @return the byte, or -1 if the end of the stream has been reached.
+     * @throws IOException if an I/O error occurs
+     */
+    int read() throws IOException;
+
+    /**
+     * Read a series of bytes into an array.
+     *
+     * @param data the array into which data is to be read
+     * @return the total number of bytes read, or -1 if there are no bytes remaining to read
+     * @throws IOException if an I/O error occurs
+     */
+    int read(byte[] data) throws IOException;
+
+    /**
+     * Read a series of bytes into an array.
+     *
+     * @param data the array into which data is to be read
+     * @param offs the start offset in the {@code data} array at which the data is written
+     * @param len the maximum number of bytes to read
+     * @return the total number of bytes read, or -1 if there are no bytes remaining to read
+     * @throws IOException if an I/O error occurs
+     */
+    int read(byte[] data, int offs, int len) throws IOException;
+
+    /**
+     * Return the number of bytes remaining.
+     *
+     * @return the number of bytes, or -1 if the byte count cannot be determined
+     */
+    int remaining();
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteOutput.java (from rev 3482, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/ByteOutput.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteOutput.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ByteOutput.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,52 @@
+package org.jboss.cx.remoting.util;
+
+import java.io.Closeable;
+import java.io.Flushable;
+import java.io.IOException;
+
+/**
+ * A writable destination for byte data.
+ */
+public interface ByteOutput extends Closeable, Flushable {
+    /**
+     * Write a single byte of data.  The input argument is truncated to 8 bits.
+     *
+     * @param b the byte to write
+     * @throws IOException if an I/O error occurs
+     */
+    void write(int b) throws IOException;
+
+    /**
+     * Write many bytes of data.
+     *
+     * @param b the bytes to write
+     * @throws IOException if an I/O error occurs
+     */
+    void write(byte[] b) throws IOException;
+
+    /**
+     * Write many bytes of data.
+     *
+     * @param b the bytes to write
+     * @param offs the offset in {@code b} to start reading bytes from
+     * @param len the number of bytes to write
+     * @throws IOException if an I/O error occurs
+     */
+    void write(byte[] b, int offs, int len) throws IOException;
+
+    /**
+     * Commit the written data.  This causes the accumulated data to be sent as a message on the underlying
+     * channel.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    void commit() throws IOException;
+
+    /**
+     * Get a count of the number of bytes written to this message.
+     *
+     * @return the count
+     * @throws IOException if an I/O error occurs
+     */
+    int getBytesWritten() throws IOException;
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/CollectionUtil.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/CollectionUtil.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,148 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Queue;
+import java.util.Set;
+import java.util.WeakHashMap;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public final class CollectionUtil {
+    private CollectionUtil() {
+    }
+
+    public static <K, V> ConcurrentMap<K, V> concurrentMap() {
+        if (true) {
+            return concurrentMap(new HashMap<K,V>());
+        } else {
+            return new ConcurrentHashMap<K, V>();
+        }
+    }
+
+    public static <K, V> ConcurrentMap<K, V> concurrentMap(Map<K, V> original) {
+        return new SynchronizedMap<K, V>(original);
+    }
+
+    public static <T> List<T> arrayList() {
+        return new ArrayList<T>();
+    }
+
+    public static <T> List<T> arrayList(List<T> orig) {
+        return new ArrayList<T>(orig);
+    }
+
+    public static <T> Set<T> synchronizedSet(Set<T> nested) {
+        return new SynchronizedSet<T>(nested);
+    }
+
+    public static <T> BlockingQueue<T> synchronizedQueue(Queue<T> nested) {
+        return new SynchronizedQueue<T>(nested);
+    }
+
+    public static <T> Set<T> weakHashSet() {
+        return new WeakHashSet<T>();
+    }
+
+    public static <T> BlockingQueue<T> blockingQueue(int size) {
+        return new ArrayBlockingQueue<T>(size);
+    }
+
+    public static <T> Iterable<T> protectedIterable(Iterable<T> original) {
+        return new DelegateIterable<T>(original);
+    }
+
+    public static <T> Set<T> hashSet() {
+        return new HashSet<T>();
+    }
+
+    public static <T> Iterable<T> loop(final Enumeration<T> enumeration) {
+        return new Iterable<T>() {
+            public Iterator<T> iterator() {
+                return new Iterator<T>() {
+                    public boolean hasNext() {
+                        return enumeration.hasMoreElements();
+                    }
+
+                    public T next() {
+                        return enumeration.nextElement();
+                    }
+
+                    public void remove() {
+                        throw new UnsupportedOperationException("remove() not supported");
+                    }
+                };
+            }
+        };
+    }
+
+    public static <T> Iterable<T> loop(final Iterator<T> iterator) {
+        return new Iterable<T>() {
+            public Iterator<T> iterator() {
+                return iterator;
+            }
+        };
+    }
+
+    public static Iterable<String> split(final String delimiter, final String subject) {
+        return new Iterable<String>() {
+            public Iterator<String> iterator() {
+                return new Iterator<String>(){
+                    private int position = 0;
+
+                    public boolean hasNext() {
+                        return position != -1;
+                    }
+
+                    public String next() {
+                        if (position == -1) {
+                            throw new NoSuchElementException("next() past end of iterator");
+                        }
+                        final int nextDelim = subject.indexOf(delimiter, position);
+                        try {
+                            if (nextDelim == -1) {
+                                return subject.substring(position);
+                            } else {
+                                return subject.substring(position, nextDelim);
+                            }
+                        } finally {
+                            position = nextDelim;
+                        }
+                    }
+
+                    public void remove() {
+                        throw new UnsupportedOperationException("remove() not supported");
+                    }
+                };
+            }
+        };
+    }
+
+    public static <K, V> Map<K, V> weakHashMap() {
+        return new WeakHashMap<K, V>();
+    }
+
+
+    public static <K, V> ConcurrentMap<K, V> concurrentWeakHashMap() {
+        return CollectionUtil.<K,V>concurrentMap(CollectionUtil.<K,V>weakHashMap());
+    }
+
+    public static <T> List<T> unmodifiableList(final T[] entries) {
+        return new UnmodifiableArrayList<T>(entries);
+    }
+
+    public static <K, V> Map<K, V> hashMap() {
+        return new HashMap<K, V>();
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/DelegateIterable.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/DelegateIterable.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/DelegateIterable.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/DelegateIterable.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,18 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Iterator;
+
+/**
+ *
+ */
+public final class DelegateIterable<T> implements Iterable<T> {
+    private final Iterable<T> delegate;
+
+    public DelegateIterable(final Iterable<T> delegate) {
+        this.delegate = delegate;
+    }
+
+    public Iterator<T> iterator() {
+        return delegate.iterator();
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/HashTypeMap.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/HashTypeMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/HashTypeMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/HashTypeMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,12 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.HashMap;
+
+/**
+ *
+ */
+public final class HashTypeMap<B> extends AbstractTypeMap<B> {
+    public HashTypeMap() {
+        super(new HashMap<Class<? extends B>, B>());
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/IoUtil.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/IoUtil.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/IoUtil.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/IoUtil.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,149 @@
+package org.jboss.cx.remoting.util;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+
+/**
+ *
+ */
+public final class IoUtil {
+    public static ByteBuffer getSlice(ByteBuffer source, int length) {
+        ByteBuffer slice = source.duplicate();
+        final int newLimit;
+        if (length < 0) {
+            // calculate from end
+            newLimit = source.limit() - length;
+        } else {
+            // calculate from start
+            newLimit = source.position() + length;
+        }
+        slice.limit(newLimit);
+        source.position(newLimit);
+        return slice;
+    }
+
+    public static void base64Decode(CharBuffer source, ByteBuffer target) throws Base64DecodingException {
+        int triad;
+        while (source.hasRemaining()) {
+            triad = 0;
+            char ch = source.get();
+            if (ch >= 'A' && ch <= 'Z') {
+                triad |= (ch - 'A') << 18;
+            } else if (ch >= 'a' && ch <= 'z') {
+                triad |= (ch - 'a' + 26) << 18;
+            } else if (ch >= '0' && ch <= '9') {
+                triad |= (ch - '0' + 52) << 18;
+            } else if (ch == '+' || ch == '-') {
+                triad |= 62 << 18;
+            } else if (ch == '/' || ch == '_') {
+                triad |= 63 << 18;
+            } else if (ch == '=') {
+                throw new Base64DecodingException("Unexpected padding encountered");
+            }
+            if (! source.hasRemaining()) {
+                throw new Base64DecodingException("Unexpected end of source data");
+            }
+
+            ch = source.get();
+            if (ch >= 'A' && ch <= 'Z') {
+                triad |= (ch - 'A') << 12;
+            } else if (ch >= 'a' && ch <= 'z') {
+                triad |= (ch - 'a' + 26) << 12;
+            } else if (ch >= '0' && ch <= '9') {
+                triad |= (ch - '0' + 52) << 12;
+            } else if (ch == '+' || ch == '-') {
+                triad |= 62 << 12;
+            } else if (ch == '/' || ch == '_') {
+                triad |= 63 << 12;
+            } else if (ch == '=') {
+                throw new Base64DecodingException("Unexpected padding encountered");
+            }
+            if (! source.hasRemaining()) {
+                throw new Base64DecodingException("Unexpected end of source data");
+            }
+
+            ch = source.get();
+            if (ch >= 'A' && ch <= 'Z') {
+                triad |= (ch - 'A') << 6;
+            } else if (ch >= 'a' && ch <= 'z') {
+                triad |= (ch - 'a' + 26) << 6;
+            } else if (ch >= '0' && ch <= '9') {
+                triad |= (ch - '0' + 52) << 6;
+            } else if (ch == '+' || ch == '-') {
+                triad |= 62 << 6;
+            } else if (ch == '/' || ch == '_') {
+                triad |= 63 << 6;
+            } else if (ch == '=') {
+                if (source.hasRemaining() && source.get() == '=') {
+                    if (! source.hasRemaining()) {
+                        target.put((byte) (triad >> 16));
+                        return;
+                    } else {
+                        throw new Base64DecodingException("Extra data after padding");
+                    }
+                } else {
+                    throw new Base64DecodingException("Unexpected end of source data");
+                }
+            }
+
+            ch = source.get();
+            if (ch >= 'A' && ch <= 'Z') {
+                triad |= ch - 'A';
+            } else if (ch >= 'a' && ch <= 'z') {
+                triad |= ch - 'a' + 26;
+            } else if (ch >= '0' && ch <= '9') {
+                triad |= ch - '0' + 52;
+            } else if (ch == '+' || ch == '-') {
+                triad |= 62;
+            } else if (ch == '/' || ch == '_') {
+                triad |= 63;
+            } else if (ch == '=') {
+                if (! source.hasRemaining()) {
+                    target.putShort((short) (triad >> 8));
+                    return;
+                } else {
+                    throw new Base64DecodingException("Extra data after padding");
+                }
+            }
+
+            target.put((byte) (triad >> 16));
+            target.putShort((short) triad);
+        }
+    }
+
+    private static final char[] base64table = new char[] {
+            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+            'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+            'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
+            'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+            'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+            'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
+            'w', 'x', 'y', 'z', '0', '1', '2', '3',
+            '4', '5', '6', '7', '8', '9', '+', '/',
+    };
+
+    public static void base64Encode(ByteBuffer source, CharBuffer target) {
+        int idx = 0;
+        while (source.hasRemaining()) {
+            int b = source.get() & 0xff;
+            target.put(base64table[b >>> 2]);
+            idx = b << 4 & 0x3f;
+            if (! source.hasRemaining()) {
+                target.put(base64table[idx]);
+                target.put("==");
+                return;
+            }
+            b = source.get() & 0xff;
+            target.put(base64table[idx | (b >>> 4)]);
+            idx = b << 2 & 0x3f;
+            if (! source.hasRemaining()) {
+                target.put(base64table[idx]);
+                target.put('=');
+                return;
+            }
+            b = source.get() & 0xff;
+            target.put(base64table[idx | (b >>> 6)]);
+            target.put(base64table[b & 0x3f]);
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/LinkedHashTypeMap.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/LinkedHashTypeMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/LinkedHashTypeMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/LinkedHashTypeMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,12 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.LinkedHashMap;
+
+/**
+ *
+ */
+public final class LinkedHashTypeMap<B> extends AbstractTypeMap<B> {
+    public LinkedHashTypeMap() {
+        super(new LinkedHashMap<Class<? extends B>, B>());
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageInput.java (from rev 3482, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/MessageInput.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageInput.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageInput.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,29 @@
+package org.jboss.cx.remoting.util;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+
+/**
+ * A readable message.
+ */
+public interface MessageInput extends ByteInput, ObjectInput {
+    /**
+     * Read an object using the current context classloader, or, if there is no such classloader, the classloader
+     * which loaded this interface.
+     *
+     * @return the object from the message
+     * @throws ClassNotFoundException if the class of the object could not be resolved by the classloader
+     * @throws IOException if an I/O error occurs
+     */
+    Object readObject() throws ClassNotFoundException, IOException;
+
+    /**
+     * Read an object using the given classloader.
+     *
+     * @param loader the classloader to use
+     * @return the object from the message
+     * @throws ClassNotFoundException if the class of the object could not be resolved by the classloader
+     * @throws IOException if an I/O error occurs
+     */
+    Object readObject(ClassLoader loader) throws ClassNotFoundException, IOException;
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageOutput.java (from rev 3482, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/MessageOutput.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageOutput.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/MessageOutput.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,9 @@
+package org.jboss.cx.remoting.util;
+
+import java.io.ObjectOutput;
+
+/**
+ * A writable message.
+ */
+public interface MessageOutput extends ByteOutput, ObjectOutput {
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/ServiceURI.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/ServiceURI.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,87 @@
+package org.jboss.cx.remoting.util;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ *
+ */
+public final class ServiceURI {
+    public static final String SCHEME = "jrs";
+
+    private static final String FIRST_CHAR = "[$_a-zA-Z]";
+    private static final String SUBSEQUENT_CHAR = "[-+$_a-zA-Z0-9]*";
+    private static final String ID = FIRST_CHAR + SUBSEQUENT_CHAR;
+    private static final String SEPARATOR = "[./]";
+
+    private static final Pattern VALID_PATTERN = Pattern.compile("^(?:" + ID + "(?:" + SEPARATOR + ID + ")*)*$");
+
+    private final URI uri;
+    private final String serviceType;
+    private final String groupName;
+    private final String endpointName;
+
+    public ServiceURI(final String str) throws URISyntaxException {
+        this(new URI(str));
+    }
+
+    public ServiceURI(final URI uri) {
+        this.uri = uri;
+        if (! uri.getScheme().equals(SCHEME)) {
+            throw new IllegalArgumentException("Invalid URI scheme for service");
+        }
+        final String ssp = uri.getSchemeSpecificPart();
+        final int stcp = ssp.indexOf(':');
+        if (stcp == -1) {
+            serviceType = ssp;
+            groupName = "";
+            endpointName = "";
+        } else {
+            serviceType = ssp.substring(0, stcp).trim();
+            final int gncp = ssp.indexOf(':', stcp + 1);
+            if (gncp == -1) {
+                groupName = ssp.substring(stcp + 1).trim();
+                endpointName = "";
+            } else {
+                groupName = ssp.substring(stcp + 1, gncp).trim();
+                // ignore everything after the last :
+                final int encp = ssp.indexOf(':', gncp + 1);
+                if (encp == -1) {
+                    endpointName = ssp.substring(gncp + 1).trim();
+                } else {
+                    endpointName = ssp.substring(gncp + 1, encp).trim();
+                }
+            }
+        }
+        final Matcher matcher = VALID_PATTERN.matcher(serviceType);
+        if (! matcher.matches()) {
+            throw new IllegalArgumentException("Syntax error in service type URI part");
+        }
+        matcher.reset(groupName);
+        if (! matcher.matches()) {
+            throw new IllegalArgumentException("Syntax error in group name URI part");
+        }
+        matcher.reset(endpointName);
+        if (! matcher.matches()) {
+            throw new IllegalArgumentException("Syntax error in endpoint name URI part");
+        }
+    }
+
+    public URI getUri() {
+        return uri;
+    }
+
+    public String getServiceType() {
+        return serviceType;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public String getEndpointName() {
+        return endpointName;
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedCollection.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/SynchronizedCollection.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedCollection.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedCollection.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,118 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ *
+ */
+public class SynchronizedCollection<V> implements Collection<V> {
+    private final Collection<V> delegate;
+    private final Object monitor;
+
+    public SynchronizedCollection(final Collection<V> delegate) {
+        this.delegate = delegate;
+        monitor = this;
+    }
+
+    protected SynchronizedCollection(final Collection<V> delegate, final Object monitor) {
+        this.delegate = delegate;
+        this.monitor = monitor;
+    }
+
+    public int size() {
+        synchronized (monitor) {
+            return delegate.size();
+        }
+    }
+
+    public boolean isEmpty() {
+        synchronized (monitor) {
+            return delegate.isEmpty();
+        }
+    }
+
+    public boolean contains(final Object o) {
+        synchronized (monitor) {
+            return delegate.contains(o);
+        }
+    }
+
+    public Iterator<V> iterator() {
+        synchronized (monitor) {
+            return new SynchronizedIterator<V>(delegate.iterator(), monitor);
+        }
+    }
+
+    public Object[] toArray() {
+        synchronized (monitor) {
+            return delegate.toArray();
+        }
+    }
+
+    public <T> T[] toArray(final T[] a) {
+        synchronized (monitor) {
+            return delegate.toArray(a);
+        }
+    }
+
+    public boolean add(final V o) {
+        synchronized (monitor) {
+            return delegate.add(o);
+        }
+    }
+
+    public boolean remove(final Object o) {
+        synchronized (monitor) {
+            return delegate.remove(o);
+        }
+    }
+
+    public boolean containsAll(final Collection<?> c) {
+        synchronized (monitor) {
+            return delegate.containsAll(c);
+        }
+    }
+
+    public boolean addAll(final Collection<? extends V> c) {
+        synchronized (monitor) {
+            return delegate.addAll(c);
+        }
+    }
+
+    public boolean removeAll(final Collection<?> c) {
+        synchronized (monitor) {
+            return delegate.removeAll(c);
+        }
+    }
+
+    public boolean retainAll(final Collection<?> c) {
+        synchronized (monitor) {
+            return delegate.retainAll(c);
+        }
+    }
+
+    public void clear() {
+        synchronized (monitor) {
+            delegate.clear();
+        }
+    }
+
+    public boolean equals(final Object o) {
+        synchronized (monitor) {
+            return delegate.equals(o);
+        }
+    }
+
+    public int hashCode() {
+        synchronized (monitor) {
+            return delegate.hashCode();
+        }
+    }
+
+    public String toString() {
+        synchronized (monitor) {
+            return delegate.toString();
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedIterator.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/SynchronizedIterator.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedIterator.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedIterator.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,52 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Iterator;
+
+/**
+ *
+ */
+public class SynchronizedIterator<T> implements Iterator<T> {
+    private final Iterator<T> delegate;
+    private final Object monitor;
+
+    protected SynchronizedIterator(final Iterator<T> delegate, final Object monitor) {
+        this.delegate = delegate;
+        this.monitor = monitor;
+    }
+
+    public boolean hasNext() {
+        synchronized (monitor) {
+            return delegate.hasNext();
+        }
+    }
+
+    public T next() {
+        synchronized (monitor) {
+            return delegate.next();
+        }
+    }
+
+    public void remove() {
+        synchronized (monitor) {
+            delegate.remove();
+        }
+    }
+
+    public int hashCode() {
+        synchronized (monitor) {
+            return delegate.hashCode();
+        }
+    }
+
+    public boolean equals(Object obj) {
+        synchronized (monitor) {
+            return delegate.equals(obj);
+        }
+    }
+
+    public String toString() {
+        synchronized (monitor) {
+            return delegate.toString();
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedMap.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/SynchronizedMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,156 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public class SynchronizedMap<K, V> implements ConcurrentMap<K, V> {
+    private final Object monitor;
+    private final Map<K, V> delegate;
+
+    public SynchronizedMap(final Map<K, V> delegate) {
+        this.delegate = delegate;
+        monitor = this;
+    }
+
+    protected SynchronizedMap(final Map<K, V> delegate, final Object monitor) {
+        this.monitor = monitor;
+        this.delegate = delegate;
+    }
+
+    public int size() {
+        synchronized (monitor) {
+            return delegate.size();
+        }
+    }
+
+    public boolean isEmpty() {
+        synchronized (monitor) {
+            return delegate.isEmpty();
+        }
+    }
+
+    public boolean containsKey(final Object key) {
+        synchronized (monitor) {
+            return delegate.containsKey(key);
+        }
+    }
+
+    public boolean containsValue(final Object value) {
+        synchronized (monitor) {
+            return delegate.containsValue(value);
+        }
+    }
+
+    public V get(final Object key) {
+        synchronized (monitor) {
+            return delegate.get(key);
+        }
+    }
+
+    public V put(final K key, final V value) {
+        synchronized (monitor) {
+            return delegate.put(key, value);
+        }
+    }
+
+    public V remove(final Object key) {
+        synchronized (monitor) {
+            return delegate.remove(key);
+        }
+    }
+
+    public void putAll(final Map<? extends K, ? extends V> t) {
+        synchronized (monitor) {
+            delegate.putAll(t);
+        }
+    }
+
+    public void clear() {
+        synchronized (monitor) {
+            delegate.clear();
+        }
+    }
+
+    public Set<K> keySet() {
+        synchronized (monitor) {
+            return new SynchronizedSet<K>(delegate.keySet(), monitor);
+        }
+    }
+
+    public Collection<V> values() {
+        synchronized (monitor) {
+            return new SynchronizedCollection<V>(delegate.values(), monitor);
+        }
+    }
+
+    public Set<Entry<K, V>> entrySet() {
+        synchronized (monitor) {
+            return new SynchronizedSet<Entry<K, V>>(delegate.entrySet(), monitor);
+        }
+    }
+
+    public boolean equals(final Object o) {
+        synchronized (monitor) {
+            return delegate.equals(o);
+        }
+    }
+
+    public int hashCode() {
+        synchronized (monitor) {
+            return delegate.hashCode();
+        }
+    }
+
+    public V putIfAbsent(final K key, final V value) {
+        synchronized (monitor) {
+            if (delegate.containsKey(key)) {
+                return delegate.get(key);
+            } else {
+                return delegate.put(key, value);
+            }
+        }
+    }
+
+    public boolean remove(final Object key, final Object value) {
+        synchronized (monitor) {
+            if (delegate.containsKey(key) && (value == null && delegate.get(key) == null || delegate.get(key).equals(value))) {
+                delegate.remove(key);
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    public boolean replace(final K key, final V oldValue, final V newValue) {
+        synchronized (monitor) {
+            if (delegate.containsKey(key) && (oldValue == null ? delegate.get(key) == null : delegate.get(key).equals(oldValue))) {
+                delegate.put(key, newValue);
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    public V replace(final K key, final V value) {
+        synchronized (monitor) {
+            if (delegate.containsKey(key)) {
+                return delegate.put(key, value);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    public String toString() {
+        synchronized (monitor) {
+            return delegate.toString();
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedQueue.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/SynchronizedQueue.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedQueue.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedQueue.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,248 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Queue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+/**
+ *
+ */
+public final class SynchronizedQueue<T> implements BlockingQueue<T> {
+    private final Queue<T> delegate;
+    private final Object monitor;
+
+    public SynchronizedQueue(final Queue<T> delegate) {
+        this.delegate = delegate;
+        monitor = this;
+    }
+
+    protected SynchronizedQueue(final Queue<T> delegate, final Object monitor) {
+        this.monitor = monitor;
+        this.delegate = delegate;
+    }
+
+    public boolean offer(final T o) {
+        synchronized(monitor) {
+            return delegate.offer(o);
+        }
+    }
+
+    public T poll() {
+        synchronized(monitor) {
+            return delegate.poll();
+        }
+    }
+
+    public T remove() {
+        synchronized(monitor) {
+            return delegate.remove();
+        }
+    }
+
+    public T peek() {
+        synchronized(monitor) {
+            return delegate.peek();
+        }
+    }
+
+    public T element() {
+        synchronized(monitor) {
+            return delegate.element();
+        }
+    }
+
+    public int size() {
+        synchronized(monitor) {
+            return delegate.size();
+        }
+    }
+
+    public boolean isEmpty() {
+        synchronized(monitor) {
+            return delegate.isEmpty();
+        }
+    }
+
+    public boolean contains(final Object o) {
+        synchronized(monitor) {
+            return delegate.contains(o);
+        }
+    }
+
+    public Iterator<T> iterator() {
+        synchronized(monitor) {
+            return delegate.iterator();
+        }
+    }
+
+    public Object[] toArray() {
+        synchronized(monitor) {
+            return delegate.toArray();
+        }
+    }
+
+    public <T> T[] toArray(final T[] a) {
+        synchronized(monitor) {
+            return delegate.toArray(a);
+        }
+    }
+
+    public boolean add(final T o) {
+        synchronized(monitor) {
+            return delegate.add(o);
+        }
+    }
+
+    public boolean remove(final Object o) {
+        synchronized(monitor) {
+            return delegate.remove(o);
+        }
+    }
+
+    public boolean containsAll(final Collection<?> c) {
+        synchronized(monitor) {
+            return delegate.containsAll(c);
+        }
+    }
+
+    public boolean addAll(final Collection<? extends T> c) {
+        synchronized(monitor) {
+            return delegate.addAll(c);
+        }
+    }
+
+    public boolean removeAll(final Collection<?> c) {
+        synchronized(monitor) {
+            return delegate.removeAll(c);
+        }
+    }
+
+    public boolean retainAll(final Collection<?> c) {
+        synchronized(monitor) {
+            return delegate.retainAll(c);
+        }
+    }
+
+    public void clear() {
+        synchronized(monitor) {
+            delegate.clear();
+        }
+    }
+
+    public boolean equals(final Object o) {
+        synchronized(monitor) {
+            return delegate.equals(o);
+        }
+    }
+
+    public int hashCode() {
+        synchronized(monitor) {
+            return delegate.hashCode();
+        }
+    }
+
+    public boolean offer(final T o, final long timeout, final TimeUnit unit) throws InterruptedException {
+        long startTime = System.currentTimeMillis();
+        long timeoutMillis = unit.toMillis(timeout);
+        long deadline = startTime + timeoutMillis < 0L ? Long.MAX_VALUE : startTime + timeoutMillis;
+        synchronized(monitor) {
+            for (;;) {
+                if (offer(o)) {
+                    return true;
+                }
+                if (deadline <= startTime) {
+                    return false;
+                }
+                monitor.wait(deadline - startTime);
+                startTime = System.currentTimeMillis();
+            }
+        }
+    }
+
+    public T poll(final long timeout, final TimeUnit unit) throws InterruptedException {
+        long startTime = System.currentTimeMillis();
+        long timeoutMillis = unit.toMillis(timeout);
+        long deadline = startTime + timeoutMillis < 0L ? Long.MAX_VALUE : startTime + timeoutMillis;
+        synchronized(monitor) {
+            for (;;) {
+                final T v = poll();
+                if (v != null) {
+                    return v;
+                }
+                if (deadline <= startTime) {
+                    return null;
+                }
+                monitor.wait(deadline - startTime);
+                startTime = System.currentTimeMillis();
+            }
+        }
+    }
+
+    public T take() throws InterruptedException {
+        synchronized(monitor) {
+            for (;;) {
+                final T v = poll();
+                if (v != null) {
+                    return v;
+                }
+                monitor.wait();
+            }
+        }
+    }
+
+    public void put(final T o) throws InterruptedException {
+        synchronized(monitor) {
+            for(;;) {
+                if (add(o)) {
+                    return;
+                }
+                monitor.wait();
+            }
+        }
+    }
+
+    public int remainingCapacity() {
+        return Integer.MAX_VALUE;
+    }
+
+    public int drainTo(final Collection<? super T> c) {
+        if (c == this) {
+            throw new IllegalArgumentException("Attempt to drain queue to itself");
+        }
+        int cnt = 0;
+        synchronized(monitor) {
+            for (;;) {
+                T v = poll();
+                if (v == null) {
+                    return cnt;
+                } else {
+                    c.add(v);
+                    cnt++;
+                }
+            }
+        }
+    }
+
+    public int drainTo(final Collection<? super T> c, final int maxElements) {
+        if (c == this) {
+            throw new IllegalArgumentException("Attempt to drain queue to itself");
+        }
+        int cnt = 0;
+        synchronized(monitor) {
+            for (;;) {
+                T v = poll();
+                if (v == null) {
+                    return cnt;
+                } else {
+                    c.add(v);
+                    cnt++;
+                    if (cnt == maxElements) {
+                        return cnt;
+                    }
+                }
+            }
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedSet.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/SynchronizedSet.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedSet.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/SynchronizedSet.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,17 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Set;
+
+/**
+ *
+ */
+public class SynchronizedSet<K> extends SynchronizedCollection<K> implements Set<K> {
+
+    public SynchronizedSet(final Set<K> delegate) {
+        super(delegate);
+    }
+
+    protected SynchronizedSet(final Set<K> delegate, final Object monitor) {
+        super(delegate, monitor);
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/TypeMap.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/TypeMap.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/TypeMap.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/TypeMap.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,45 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ *
+ */
+public interface TypeMap<B> {
+    void clear();
+
+    boolean containsKey(Class<?> key);
+
+    boolean containsValue(Object value);
+
+    Set<Entry<? extends B>> entrySet();
+
+    <T extends B> T get(Class<T> key);
+
+    boolean isEmpty();
+
+    Set<Class<? extends B>> keySet();
+
+    <T extends B> T put(Class<T> key, T value);
+
+    <T extends B> void putAll(TypeMap<T> m);
+
+    <T extends B> T remove(Class<T> key);
+
+    int size();
+
+    Collection<? extends B> values();
+
+    <T extends B> T putIfAbsent(Class<T> key, T value);
+
+    <T extends B> boolean remove(Class<T> key, Object value);
+
+    <T extends B> T replace(Class<T> key, T value);
+
+    <T extends B> boolean replace(Class<T> key, T oldValue, T newValue);
+
+    interface Entry<T> extends Map.Entry<Class<T>, T> {
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/UnmodifiableArrayList.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/UnmodifiableArrayList.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/UnmodifiableArrayList.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/UnmodifiableArrayList.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,143 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.AbstractList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+/**
+ *
+ */
+public final class UnmodifiableArrayList<T> extends AbstractList<T> implements List<T> {
+
+    private final Object[] entries;
+    private final int offs;
+    private final int length;
+
+    <T> UnmodifiableArrayList(final T[] entries) {
+        this.entries = entries;
+        offs = 0;
+        length = entries.length;
+    }
+
+    <T> UnmodifiableArrayList(final T[] entries, int offs, int length) {
+        if (offs > entries.length) {
+            throw new IndexOutOfBoundsException("Specified offset is greater than array length");
+        }
+        if (offs + length > entries.length) {
+            throw new IndexOutOfBoundsException("Specified offset + length is greater than array length");
+        }
+        this.entries = entries;
+        this.offs = offs;
+        this.length = length;
+    }
+
+    public int size() {
+        return length;
+    }
+
+    public boolean isEmpty() {
+        return length == 0;
+    }
+
+    public boolean contains(final Object o) {
+        for (int i = 0; i < length; i ++) {
+            final Object e = entries[i + offs];
+            if (o==null ? e==null : o.equals(e)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public Iterator<T> iterator() {
+        return new ListIteratorImpl<T>();
+    }
+
+    @SuppressWarnings ({"unchecked"})
+    public T get(final int index) {
+        if (index >= length || index < 0) {
+            throw new IndexOutOfBoundsException("Invalid get() index: " + index + " (size is " + length + ")");
+        }
+        return (T) entries[offs + index];
+    }
+
+    public ListIterator<T> listIterator() {
+        return new ListIteratorImpl<T>();
+    }
+
+    public ListIterator<T> listIterator(final int index) {
+        return new ListIteratorImpl<T>(index);
+    }
+
+    public List<T> subList(final int fromIndex, final int toIndex) {
+        if (fromIndex < 0 || fromIndex > length) {
+            throw new IndexOutOfBoundsException("fromIndex " + fromIndex + " is not within the bounds of the list (size is " + length + ")");
+        }
+        if (toIndex < 0 || toIndex > length) {
+            throw new IndexOutOfBoundsException("toIndex " + toIndex + " is not within the bounds of the list (size is " + length + ")");
+        }
+        if (fromIndex > toIndex) {
+            throw new IllegalArgumentException("fromIndex " + fromIndex + " is greater than toIndex " + toIndex);
+        }
+        return new UnmodifiableArrayList<T>(entries, offs + fromIndex, toIndex - fromIndex);
+    }
+
+    public final class ListIteratorImpl<T> implements ListIterator<T> {
+        private int i;
+
+        private ListIteratorImpl(final int index) {
+            i = index;
+        }
+
+        private ListIteratorImpl() {
+        }
+
+        public boolean hasNext() {
+            return i < length;
+        }
+
+        @SuppressWarnings ({"unchecked"})
+        public T next() {
+            if (i < length) {
+                return (T) entries[offs + i++];
+            } else {
+                throw new NoSuchElementException("next() past end of iterator");
+            }
+        }
+
+        public boolean hasPrevious() {
+            return i > 0;
+        }
+
+        @SuppressWarnings ({"unchecked"})
+        public T previous() {
+            if (i > 0) {
+                return (T) entries[offs + i--];
+            } else {
+                throw new NoSuchElementException("next() past end of iterator");
+            }
+        }
+
+        public int nextIndex() {
+            return i;
+        }
+
+        public int previousIndex() {
+            return i - 1;
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException("remove() not allowed");
+        }
+
+        public void set(final T o) {
+            throw new UnsupportedOperationException("set() not allowed");
+        }
+
+        public void add(final T o) {
+            throw new UnsupportedOperationException("add() not allowed");
+        }
+    }
+}

Copied: remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/WeakHashSet.java (from rev 3470, remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/core/util/WeakHashSet.java)
===================================================================
--- remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/WeakHashSet.java	                        (rev 0)
+++ remoting3/trunk/util/src/main/java/org/jboss/cx/remoting/util/WeakHashSet.java	2008-02-22 16:55:56 UTC (rev 3483)
@@ -0,0 +1,76 @@
+package org.jboss.cx.remoting.util;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.WeakHashMap;
+
+/**
+ *
+ */
+public final class WeakHashSet<T> implements Set<T> {
+    private final WeakHashMap<T,Void> map = new WeakHashMap<T,Void>();
+
+    public int size() {
+        return map.size();
+    }
+
+    public boolean isEmpty() {
+        return map.isEmpty();
+    }
+
+    public boolean contains(final Object o) {
+        return map.containsKey(o);
+    }
+
+    public Iterator<T> iterator() {
+        return map.keySet().iterator();
+    }
+
+    public Object[] toArray() {
+        return map.keySet().toArray();
+    }
+
+    public <T> T[] toArray(final T[] a) {
+        return map.keySet().toArray(a);
+    }
+
+    public boolean add(final T o) {
+        try {
+            return ! map.containsKey(o);
+        } finally {
+            map.put(o, null);
+        }
+    }
+
+    public boolean remove(final Object o) {
+        return map.keySet().remove(o);
+    }
+
+    public boolean containsAll(final Collection<?> c) {
+        return map.keySet().containsAll(c);
+    }
+
+    public boolean addAll(final Collection<? extends T> c) {
+        boolean changed = false;
+        for (T t : c) {
+            if (! map.containsKey(t)) {
+                changed = true;
+                map.put(t, null);
+            }
+        }
+        return changed;
+    }
+
+    public boolean retainAll(final Collection<?> c) {
+        return map.keySet().retainAll(c);
+    }
+
+    public boolean removeAll(final Collection<?> c) {
+        return map.keySet().removeAll(c);
+    }
+
+    public void clear() {
+        map.clear();
+    }
+}




More information about the jboss-remoting-commits mailing list