You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ru...@apache.org on 2007/06/11 18:44:10 UTC

svn commit: r546190 [1/6] - in /incubator/qpid/branches/M2/java: ./ broker/ client/ client/example/ client/src/main/java/org/apache/qpid/client/ client/src/main/java/org/apache/qpid/client/failover/ client/src/main/java/org/apache/qpid/client/handler/ ...

Author: rupertlssmith
Date: Mon Jun 11 09:43:57 2007
New Revision: 546190

URL: http://svn.apache.org/viewvc?view=rev&rev=546190
Log:
Removed log4j dependency from client. Using slf4j instead, end-user to supply logging implementation as desired. Log4j used for tests.

Modified:
    incubator/qpid/branches/M2/java/broker/pom.xml
    incubator/qpid/branches/M2/java/client/example/pom.xml
    incubator/qpid/branches/M2/java/client/pom.xml
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/Closeable.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverProtectedOperation.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverState.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverSupport.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicCancelOkMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicDeliverMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicReturnMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseOkMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelFlowOkMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionRedirectMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionTuneMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ExchangeBoundOkMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/QueueDeleteOkMethodHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessage.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/message/AbstractJMSMessageFactory.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/message/JMSMapMessage.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/message/MessageConverter.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/protocol/AMQProtocolSession.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/protocol/HeartbeatConfig.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/protocol/ProtocolBufferMonitorFilter.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/security/CallbackHandlerRegistry.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/security/DynamicSaslRegistrar.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/security/JCAProvider.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/security/UsernameHashedPasswordCallbackHandler.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/state/AMQStateManager.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/transport/SocketTransportConnection.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/transport/TransportConnection.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/transport/VmPipeTransportConnection.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/jms/FailoverPolicy.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/jms/failover/FailoverRoundRobinServers.java
    incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/client/DispatcherTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/client/MessageListenerMultiConsumerImmediatePrefetch.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/client/MessageListenerMultiConsumerTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/client/MessageListenerTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/client/ResetMessageListenerTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/ack/RecoverTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/BytesMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/FieldTableMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/LargeMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MapMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/MultipleConnectionTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/ObjectMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/PropertyValueTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SelectorTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/SessionStartTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/TextMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/basic/close/CloseTests.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseMethodHandlerNoCloseOk.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseOkTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/channelclose/ChannelCloseTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/Client.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/CombinedTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/forwardall/ServiceCreator.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/client/message/ObjectMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/close/CloseBeforeAckTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/close/MessageRequeueTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSDestinationTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/message/JMSPropertiesTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/message/StreamMessageTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/topic/DurableSubscriptionTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/transacted/CommitRollbackTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/test/unit/transacted/TransactedTest.java
    incubator/qpid/branches/M2/java/client/src/test/java/org/apache/qpid/testutil/QpidClientConnection.java
    incubator/qpid/branches/M2/java/common/pom.xml
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/common/QpidProperties.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockDecoder.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/AMQDataBlockEncoder.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/AMQMethodBodyFactory.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/AMQShortString.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/BasicContentHeaderProperties.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/CommonContentHeaderProperties.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/ContentBodyFactory.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/ContentHeaderBodyFactory.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/EncodingUtils.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/FieldTable.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/framing/VersionSpecificRegistry.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/pool/PoolingFilter.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/url/AMQBindingURL.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/util/ConcurrentLinkedMessageQueueAtomicSize.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/util/FileUtils.java
    incubator/qpid/branches/M2/java/common/src/main/java/org/apache/qpid/util/PropertiesUtils.java
    incubator/qpid/branches/M2/java/common/src/test/java/org/apache/qpid/framing/PropertyFieldTableTest.java
    incubator/qpid/branches/M2/java/common/src/test/java/org/apache/qpid/util/CommandLineParserTest.java
    incubator/qpid/branches/M2/java/integrationtests/src/main/java/org/apache/qpid/interop/testclient/testcases/TestCase1DummyRun.java
    incubator/qpid/branches/M2/java/management/eclipse-plugin/pom.xml
    incubator/qpid/branches/M2/java/pom.xml
    incubator/qpid/branches/M2/java/systests/pom.xml

Modified: incubator/qpid/branches/M2/java/broker/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/broker/pom.xml?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/broker/pom.xml (original)
+++ incubator/qpid/branches/M2/java/broker/pom.xml Mon Jun 11 09:43:57 2007
@@ -15,7 +15,7 @@
     KIND, either express or implied. See the License for the
     specific language governing permissions and limitations
     under the License.
-  -->
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
     <modelVersion>4.0.0</modelVersion>
@@ -44,6 +44,11 @@
         </dependency>
 
         <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>commons-cli</groupId>
             <artifactId>commons-cli</artifactId>
         </dependency>
@@ -58,7 +63,14 @@
             <artifactId>commons-lang</artifactId>
         </dependency>
 
-	<!-- Test Dependencies -->
+        <!-- Test Dependencies -->
+        <dependency>  
+            <groupId>org.slf4j</groupId> 
+            <artifactId>slf4j-log4j12</artifactId>  
+            <version>1.4.0</version>  
+            <scope>test</scope> 
+        </dependency>
+
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
@@ -168,8 +180,8 @@
                                 <tasks>
 
                                     <condition property="broker.dir" 
-                                             else="${user.dir}${file.separator}broker"
-                                             value="${user.dir}">
+                                               else="${user.dir}${file.separator}broker"
+                                               value="${user.dir}">
                                         <contains string="${user.dir}" substring="broker" />
                                     </condition>
 
@@ -179,7 +191,7 @@
 
                                     <property name="command" 
                                               value="python run-tests -v -I java_failing.txt"/>
-                                              <!--value="bash -c 'python run-tests -v -I java_failing.txt'"/>-->
+                                    <!--value="bash -c 'python run-tests -v -I java_failing.txt'"/>-->
 
                                     <ant antfile="python-test.xml" inheritRefs="true">
                                         <target name="run-tests" />

Modified: incubator/qpid/branches/M2/java/client/example/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/example/pom.xml?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/example/pom.xml (original)
+++ incubator/qpid/branches/M2/java/client/example/pom.xml Mon Jun 11 09:43:57 2007
@@ -43,9 +43,15 @@
             <groupId>org.apache.qpid</groupId>
             <artifactId>qpid-common</artifactId>
         </dependency>
+
         <dependency>
             <groupId>org.apache.qpid</groupId>
             <artifactId>qpid-client</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
         </dependency>
 
         <dependency>

Modified: incubator/qpid/branches/M2/java/client/pom.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/pom.xml?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/pom.xml (original)
+++ incubator/qpid/branches/M2/java/client/pom.xml Mon Jun 11 09:43:57 2007
@@ -48,6 +48,12 @@
             <artifactId>qpid-common</artifactId>
         </dependency>
 
+        <dependency>  
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>  
+            <version>1.4.0</version> 
+        </dependency>
+
         <dependency>
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-jms_1.1_spec</artifactId>
@@ -56,13 +62,6 @@
         <dependency>
             <groupId>commons-collections</groupId>
             <artifactId>commons-collections</artifactId>
-            <!-- commons collection exports log4j v1.2.7 which doesn't have trace()-->
-            <exclusions>
-                <exclusion>
-                    <groupId>log4j</groupId>
-                    <artifactId>log4j</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
 
         <dependency>
@@ -76,23 +75,17 @@
         </dependency>
 
         <!-- Test Dependencies -->
+        <dependency>  
+            <groupId>org.slf4j</groupId> 
+            <artifactId>slf4j-log4j12</artifactId>  
+            <version>1.4.0</version>  
+            <scope>test</scope> 
+        </dependency>
+
         <dependency> <!-- for inVm Broker -->
             <groupId>org.apache.qpid</groupId>
             <artifactId>qpid-broker</artifactId>
             <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>jmscts</groupId>
-            <artifactId>jmscts</artifactId>
-            <version>0.5-b2</version>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>jms</groupId>
-                    <artifactId>jms</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
 
         <dependency>

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Mon Jun 11 09:43:57 2007
@@ -20,8 +20,6 @@
  */
 package org.apache.qpid.client;
 
-import org.apache.log4j.Logger;
-
 import org.apache.qpid.AMQConnectionFailureException;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.AMQUndeliveredException;
@@ -48,6 +46,9 @@
 import org.apache.qpid.jms.FailoverPolicy;
 import org.apache.qpid.url.URLSyntaxException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import javax.jms.*;
 import javax.jms.IllegalStateException;
 import javax.naming.NamingException;
@@ -71,7 +72,7 @@
 
 public class AMQConnection extends Closeable implements Connection, QueueConnection, TopicConnection, Referenceable
 {
-    private static final Logger _logger = Logger.getLogger(AMQConnection.class);
+    private static final Logger _logger = LoggerFactory.getLogger(AMQConnection.class);
 
     private AtomicInteger _idFactory = new AtomicInteger(0);
 

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQQueueBrowser.java Mon Jun 11 09:43:57 2007
@@ -20,9 +20,8 @@
  */
 package org.apache.qpid.client;
 
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.concurrent.atomic.AtomicBoolean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.jms.IllegalStateException;
 import javax.jms.JMSException;
@@ -30,12 +29,13 @@
 import javax.jms.Queue;
 import javax.jms.QueueBrowser;
 
-import org.apache.log4j.Logger;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 public class AMQQueueBrowser implements QueueBrowser
 {
-    private static final Logger _logger = Logger.getLogger(AMQQueueBrowser.class);
-
+    private static final Logger _logger = LoggerFactory.getLogger(AMQQueueBrowser.class);
 
     private AtomicBoolean _isClosed = new AtomicBoolean();
     private final AMQSession _session;
@@ -43,20 +43,21 @@
     private final ArrayList<BasicMessageConsumer> _consumers = new ArrayList<BasicMessageConsumer>();
     private final String _messageSelector;
 
-
     AMQQueueBrowser(AMQSession session, AMQQueue queue, String messageSelector) throws JMSException
     {
         _session = session;
         _queue = queue;
-        _messageSelector = (messageSelector == null) || (messageSelector.trim().length() == 0) ? null : messageSelector;
+        _messageSelector = ((messageSelector == null) || (messageSelector.trim().length() == 0)) ? null : messageSelector;
         // Create Consumer to verify message selector.
-        BasicMessageConsumer consumer = (BasicMessageConsumer) _session.createBrowserConsumer(_queue, _messageSelector, false);
-        consumer.close();        
+        BasicMessageConsumer consumer =
+            (BasicMessageConsumer) _session.createBrowserConsumer(_queue, _messageSelector, false);
+        consumer.close();
     }
 
     public Queue getQueue() throws JMSException
     {
         checkState();
+
         return _queue;
     }
 
@@ -66,6 +67,7 @@
         {
             throw new IllegalStateException("Queue Browser");
         }
+
         if (_session.isClosed())
         {
             throw new IllegalStateException("Session is closed");
@@ -77,47 +79,48 @@
     {
 
         checkState();
+
         return _messageSelector;
     }
 
     public Enumeration getEnumeration() throws JMSException
     {
         checkState();
-        final BasicMessageConsumer consumer = (BasicMessageConsumer) _session.createBrowserConsumer(_queue, _messageSelector, false);
+        final BasicMessageConsumer consumer =
+            (BasicMessageConsumer) _session.createBrowserConsumer(_queue, _messageSelector, false);
         _consumers.add(consumer);
 
         return new Enumeration()
-        {
-
-
-            Message _nextMessage = consumer.receive();
-
-
-            public boolean hasMoreElements()
             {
-                _logger.info("QB:hasMoreElements:" + (_nextMessage != null));
-                return (_nextMessage != null);
-            }
 
-            public Object nextElement()
-            {
-                Message msg = _nextMessage;
-                try
+                Message _nextMessage = consumer.receive();
+
+                public boolean hasMoreElements()
                 {
-                    _logger.info("QB:nextElement about to receive");
+                    _logger.info("QB:hasMoreElements:" + (_nextMessage != null));
 
-                    _nextMessage = consumer.receive();
-                    _logger.info("QB:nextElement received:" + _nextMessage);
+                    return (_nextMessage != null);
                 }
-                catch (JMSException e)    
+
+                public Object nextElement()
                 {
-                    _logger.warn("Exception caught while queue browsing", e);
-                    _nextMessage = null;
-                }
+                    Message msg = _nextMessage;
+                    try
+                    {
+                        _logger.info("QB:nextElement about to receive");
+
+                        _nextMessage = consumer.receive();
+                        _logger.info("QB:nextElement received:" + _nextMessage);
+                    }
+                    catch (JMSException e)
+                    {
+                        _logger.warn("Exception caught while queue browsing", e);
+                        _nextMessage = null;
+                    }
 
-                return msg;
-            }
-        };
+                    return msg;
+                }
+            };
     }
 
     public void close() throws JMSException
@@ -126,8 +129,8 @@
         {
             consumer.close();
         }
+
         _consumers.clear();
     }
-
 
 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQSession.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQSession.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/AMQSession.java Mon Jun 11 09:43:57 2007
@@ -20,8 +20,6 @@
  */
 package org.apache.qpid.client;
 
-import org.apache.log4j.Logger;
-
 import org.apache.qpid.AMQException;
 import org.apache.qpid.AMQInvalidArgumentException;
 import org.apache.qpid.AMQInvalidRoutingKeyException;
@@ -75,6 +73,9 @@
 import org.apache.qpid.url.AMQBindingURL;
 import org.apache.qpid.url.URLSyntaxException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import javax.jms.BytesMessage;
 import javax.jms.Destination;
 import javax.jms.IllegalStateException;
@@ -111,14 +112,30 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 /**
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td>
+ * </table>
+ *
+ * @todo Different FailoverSupport implementation are needed on the same method call, in different situations. For
+ *       example, when failing-over and reestablishing the bindings, the bind cannot be interrupted by a second
+ *       fail-over, if it fails with an exception, the fail-over process should also fail. When binding outside of
+ *       the fail-over process, the retry handler could be used to automatically retry the operation once the connection
+ *       has been reestablished. All fail-over protected operations should be placed in private methods, with
+ *       FailoverSupport passed in by the caller to provide the correct support for the calling context. Sometimes the
+ *       fail-over process sets a nowait flag and uses an async method call instead.
+ *
+ * @todo Two new objects created on every failover supported method call. Consider more efficient ways of doing this,
+ *       after looking at worse bottlenecks first.
  */
 public class AMQSession extends Closeable implements Session, QueueSession, TopicSession
 {
     /** Used for debugging. */
-    private static final Logger _logger = Logger.getLogger(AMQSession.class);
+    private static final Logger _logger = LoggerFactory.getLogger(AMQSession.class);
 
     /** Used for debugging in the dispatcher. */
-    private static final Logger _dispatcherLogger = Logger.getLogger(Dispatcher.class);
+    private static final Logger _dispatcherLogger = LoggerFactory.getLogger(Dispatcher.class);
 
     /** The default maximum number of prefetched message at which to suspend the channel. */
     public static final int DEFAULT_PREFETCH_HIGH_MARK = 5000;
@@ -365,6 +382,28 @@
             defaultPrefetchLow);
     }
 
+    // ===== JMS Session methods.
+
+    /**
+     * Closes the session with no timeout.
+     *
+     * @throws JMSException If the JMS provider fails to close the session due to some internal error.
+     */
+    public void close() throws JMSException
+    {
+        close(-1);
+    }
+
+    public BytesMessage createBytesMessage() throws JMSException
+    {
+        synchronized (_connection.getFailoverMutex())
+        {
+            checkNotClosed();
+
+            return new JMSBytesMessage();
+        }
+    }
+
     /**
      * Acknowledges all unacknowledged messages on the session, for all message consumers on the session.
      *
@@ -447,16 +486,6 @@
     }
 
     /**
-     * Closes the session with no timeout.
-     *
-     * @throws JMSException If the JMS provider fails to close the session due to some internal error.
-     */
-    public void close() throws JMSException
-    {
-        close(-1);
-    }
-
-    /**
      * Closes the session.
      *
      * <p/>Note that this operation succeeds automatically if a fail-over interupts the sycnronous request to close
@@ -678,16 +707,6 @@
 
         return createConsumerImpl(destination, _defaultPrefetchHighMark, _defaultPrefetchLowMark, noLocal, false,
                 messageSelector, null, true, true);
-    }
-
-    public BytesMessage createBytesMessage() throws JMSException
-    {
-        synchronized (_connection.getFailoverMutex())
-        {
-            checkNotClosed();
-
-            return new JMSBytesMessage();
-        }
     }
 
     public MessageConsumer createConsumer(Destination destination) throws JMSException

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageConsumer.java Mon Jun 11 09:43:57 2007
@@ -20,8 +20,6 @@
  */
 package org.apache.qpid.client;
 
-import org.apache.log4j.Logger;
-
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.failover.FailoverException;
 import org.apache.qpid.client.message.AbstractJMSMessage;
@@ -36,6 +34,9 @@
 import org.apache.qpid.jms.MessageConsumer;
 import org.apache.qpid.jms.Session;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.jms.MessageListener;
@@ -51,7 +52,7 @@
 
 public class BasicMessageConsumer extends Closeable implements MessageConsumer
 {
-    private static final Logger _logger = Logger.getLogger(BasicMessageConsumer.class);
+    private static final Logger _logger = LoggerFactory.getLogger(BasicMessageConsumer.class);
 
     /** The connection being used by this consumer */
     private AMQConnection _connection;

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/BasicMessageProducer.java Mon Jun 11 09:43:57 2007
@@ -20,8 +20,23 @@
  */
 package org.apache.qpid.client;
 
-import java.io.UnsupportedEncodingException;
-import java.util.UUID;
+import org.apache.mina.common.ByteBuffer;
+
+import org.apache.qpid.AMQException;
+import org.apache.qpid.client.message.AbstractJMSMessage;
+import org.apache.qpid.client.message.MessageConverter;
+import org.apache.qpid.client.protocol.AMQProtocolHandler;
+import org.apache.qpid.framing.AMQFrame;
+import org.apache.qpid.framing.BasicConsumeBody;
+import org.apache.qpid.framing.BasicContentHeaderProperties;
+import org.apache.qpid.framing.BasicPublishBody;
+import org.apache.qpid.framing.CompositeAMQDataBlock;
+import org.apache.qpid.framing.ContentBody;
+import org.apache.qpid.framing.ContentHeaderBody;
+import org.apache.qpid.framing.ExchangeDeclareBody;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.jms.BytesMessage;
 import javax.jms.DeliveryMode;
@@ -36,24 +51,12 @@
 import javax.jms.TextMessage;
 import javax.jms.Topic;
 
-import org.apache.log4j.Logger;
-import org.apache.mina.common.ByteBuffer;
-import org.apache.qpid.AMQException;
-import org.apache.qpid.client.message.AbstractJMSMessage;
-import org.apache.qpid.client.message.MessageConverter;
-import org.apache.qpid.client.protocol.AMQProtocolHandler;
-import org.apache.qpid.framing.AMQFrame;
-import org.apache.qpid.framing.BasicConsumeBody;
-import org.apache.qpid.framing.BasicContentHeaderProperties;
-import org.apache.qpid.framing.BasicPublishBody;
-import org.apache.qpid.framing.CompositeAMQDataBlock;
-import org.apache.qpid.framing.ContentBody;
-import org.apache.qpid.framing.ContentHeaderBody;
-import org.apache.qpid.framing.ExchangeDeclareBody;
+import java.io.UnsupportedEncodingException;
+import java.util.UUID;
 
 public class BasicMessageProducer extends Closeable implements org.apache.qpid.jms.MessageProducer
 {
-    protected final Logger _logger = Logger.getLogger(getClass());
+    protected final Logger _logger = LoggerFactory.getLogger(getClass());
 
     private AMQConnection _connection;
 
@@ -119,14 +122,14 @@
     private final boolean _mandatory;
 
     private final boolean _waitUntilSent;
-    
+
     private boolean _disableMessageId;
-        
+
     private static final ContentBody[] NO_CONTENT_BODIES = new ContentBody[0];
 
     protected BasicMessageProducer(AMQConnection connection, AMQDestination destination, boolean transacted, int channelId,
-                                   AMQSession session, AMQProtocolHandler protocolHandler, long producerId,
-                                   boolean immediate, boolean mandatory, boolean waitUntilSent)
+        AMQSession session, AMQProtocolHandler protocolHandler, long producerId, boolean immediate, boolean mandatory,
+        boolean waitUntilSent)
     {
         _connection = connection;
         _destination = destination;
@@ -160,15 +163,15 @@
         // TODO: Be aware of possible changes to parameter order as versions change.
         AMQFrame declare =
             ExchangeDeclareBody.createAMQFrame(_channelId, _protocolHandler.getProtocolMajorVersion(),
-                                               _protocolHandler.getProtocolMinorVersion(), null, // arguments
-                                               false, // autoDelete
-                                               false, // durable
-                                               destination.getExchangeName(), // exchange
-                                               false, // internal
-                                               true, // nowait
-                                               false, // passive
-                                               _session.getTicket(), // ticket
-                                               destination.getExchangeClass()); // type
+                _protocolHandler.getProtocolMinorVersion(), null, // arguments
+                false, // autoDelete
+                false, // durable
+                destination.getExchangeName(), // exchange
+                false, // internal
+                true, // nowait
+                false, // passive
+                _session.getTicket(), // ticket
+                destination.getExchangeClass()); // type
         _protocolHandler.writeFrame(declare);
     }
 
@@ -205,7 +208,7 @@
         if ((i != DeliveryMode.NON_PERSISTENT) && (i != DeliveryMode.PERSISTENT))
         {
             throw new JMSException("DeliveryMode must be either NON_PERSISTENT or PERSISTENT. Value of " + i
-                                   + " is illegal");
+                + " is illegal");
         }
 
         _deliveryMode = i;
@@ -317,12 +320,12 @@
         {
             validateDestination(destination);
             sendImpl((AMQDestination) destination, message, _deliveryMode, _messagePriority, _timeToLive, _mandatory,
-                     _immediate);
+                _immediate);
         }
     }
 
     public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive)
-              throws JMSException
+        throws JMSException
     {
         checkPreConditions();
         checkDestination(destination);
@@ -334,7 +337,7 @@
     }
 
     public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive,
-                     boolean mandatory) throws JMSException
+        boolean mandatory) throws JMSException
     {
         checkPreConditions();
         checkDestination(destination);
@@ -346,7 +349,7 @@
     }
 
     public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive,
-                     boolean mandatory, boolean immediate) throws JMSException
+        boolean mandatory, boolean immediate) throws JMSException
     {
         checkPreConditions();
         checkDestination(destination);
@@ -358,7 +361,7 @@
     }
 
     public void send(Destination destination, Message message, int deliveryMode, int priority, long timeToLive,
-                     boolean mandatory, boolean immediate, boolean waitUntilSent) throws JMSException
+        boolean mandatory, boolean immediate, boolean waitUntilSent) throws JMSException
     {
         checkPreConditions();
         checkDestination(destination);
@@ -366,7 +369,7 @@
         {
             validateDestination(destination);
             sendImpl((AMQDestination) destination, message, deliveryMode, priority, timeToLive, mandatory, immediate,
-                     waitUntilSent);
+                waitUntilSent);
         }
     }
 
@@ -412,7 +415,7 @@
             else
             {
                 throw new JMSException("Unable to send message, due to class conversion error: "
-                                       + message.getClass().getName());
+                    + message.getClass().getName());
             }
         }
     }
@@ -422,14 +425,14 @@
         if (!(destination instanceof AMQDestination))
         {
             throw new JMSException("Unsupported destination class: "
-                                   + ((destination != null) ? destination.getClass() : null));
+                + ((destination != null) ? destination.getClass() : null));
         }
 
         declareDestination((AMQDestination) destination);
     }
 
     protected void sendImpl(AMQDestination destination, Message message, int deliveryMode, int priority, long timeToLive,
-                            boolean mandatory, boolean immediate) throws JMSException
+        boolean mandatory, boolean immediate) throws JMSException
     {
         sendImpl(destination, message, deliveryMode, priority, timeToLive, mandatory, immediate, _waitUntilSent);
     }
@@ -447,23 +450,23 @@
      * @throws JMSException
      */
     protected void sendImpl(AMQDestination destination, Message origMessage, int deliveryMode, int priority, long timeToLive,
-                            boolean mandatory, boolean immediate, boolean wait) throws JMSException
+        boolean mandatory, boolean immediate, boolean wait) throws JMSException
     {
         checkTemporaryDestination(destination);
         origMessage.setJMSDestination(destination);
 
         AbstractJMSMessage message = convertToNativeMessage(origMessage);
-        
-        if(_disableMessageId)
+
+        if (_disableMessageId)
         {
-        	message.setJMSMessageID(null);
+            message.setJMSMessageID(null);
         }
         else
         {
-        	if (message.getJMSMessageID() == null)
-        	{
-        		message.setJMSMessageID(UUID.randomUUID().toString());
-        	}
+            if (message.getJMSMessageID() == null)
+            {
+                message.setJMSMessageID(UUID.randomUUID().toString());
+            }
         }
 
         int type;
@@ -486,9 +489,8 @@
         // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
         // Be aware of possible changes to parameter order as versions change.
         AMQFrame publishFrame =
-            BasicPublishBody.createAMQFrame(
-                _channelId, _protocolHandler.getProtocolMajorVersion(), _protocolHandler.getProtocolMinorVersion(),
-                destination.getExchangeName(), // exchange
+            BasicPublishBody.createAMQFrame(_channelId, _protocolHandler.getProtocolMajorVersion(),
+                _protocolHandler.getProtocolMinorVersion(), destination.getExchangeName(), // exchange
                 immediate, // immediate
                 mandatory, // mandatory
                 destination.getRoutingKey(), // routingKey
@@ -535,9 +537,8 @@
         // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
         AMQFrame contentHeaderFrame =
             ContentHeaderBody.createAMQFrame(_channelId,
-                                             BasicConsumeBody.getClazz(_protocolHandler.getProtocolMajorVersion(),
-                                                                       _protocolHandler.getProtocolMinorVersion()), 0,
-                                             contentHeaderProperties, size);
+                BasicConsumeBody.getClazz(_protocolHandler.getProtocolMajorVersion(),
+                    _protocolHandler.getProtocolMinorVersion()), 0, contentHeaderProperties, size);
         if (_logger.isDebugEnabled())
         {
             _logger.debug("Sending content header frame to " + destination);
@@ -685,6 +686,6 @@
 
     public boolean isBound(AMQDestination destination) throws JMSException
     {
-        return _session.isQueueBound(destination.getExchangeName(),null,destination.getRoutingKey());
+        return _session.isQueueBound(destination.getExchangeName(), null, destination.getRoutingKey());
     }
 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/Closeable.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/Closeable.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/Closeable.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/Closeable.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,12 +20,29 @@
  */
 package org.apache.qpid.client;
 
-import java.util.concurrent.atomic.AtomicBoolean;
-
 import javax.jms.IllegalStateException;
 import javax.jms.JMSException;
 
-/** Provides support for orderly shutdown of an object. */
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * Captures the 'closed' state of an object, that is initially open, can be tested to see if it is closed, and provides
+ * a 'close' method to close it.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Mark an object as closed.
+ * <tr><td> Check if an object is closed.
+ * <tr><td> Raise a JMS exception if an object is closed.
+ * </table>
+ *
+ * @todo Might be better to make this an interface. This whole class doesn't really encapsulate a terribly neat
+ *       piece of re-usable functionality. A simple interface defining a close method would suffice.
+ *
+ * @todo The convenience method {@link #checkNotClosed} is not that helpfull, what if the caller wants to do something
+ *       other than throw an exception? It doesn't really represent a very usefull re-usable piece of code. Consider
+ *       inlining it and dropping the method.
+ */
 public abstract class Closeable
 {
     /**
@@ -34,6 +51,11 @@
      */
     protected final AtomicBoolean _closed = new AtomicBoolean(false);
 
+    /**
+     * Checks if this is closed, and raises a JMSException if it is.
+     *
+     * @throws JMSException If this is closed.
+     */
     protected void checkNotClosed() throws JMSException
     {
         if (isClosed())
@@ -42,13 +64,20 @@
         }
     }
 
+    /**
+     * Checks if this is closed.
+     *
+     * @return <tt>true</tt> if this is closed, <tt>false</tt> otherwise.
+     */
     public boolean isClosed()
     {
-//        synchronized (_closed)
-        {
-            return _closed.get();
-        }
+        return _closed.get();
     }
 
+    /**
+     * Closes this object.
+     *
+     * @throws JMSException If this cannot be closed for any reason.
+     */
     public abstract void close() throws JMSException;
 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverHandler.java Mon Jun 11 09:43:57 2007
@@ -20,14 +20,15 @@
  */
 package org.apache.qpid.client.failover;
 
-import org.apache.log4j.Logger;
-
 import org.apache.mina.common.IoSession;
 
 import org.apache.qpid.AMQDisconnectedException;
 import org.apache.qpid.client.protocol.AMQProtocolHandler;
 import org.apache.qpid.client.state.AMQStateManager;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.util.concurrent.CountDownLatch;
 
 /**
@@ -78,7 +79,7 @@
 public class FailoverHandler implements Runnable
 {
     /** Used for debugging. */
-    private static final Logger _logger = Logger.getLogger(FailoverHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(FailoverHandler.class);
 
     /** Holds the MINA session for the connection that has failed, not the connection that is being failed onto. */
     private final IoSession _session;

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverNoopSupport.java Mon Jun 11 09:43:57 2007
@@ -7,11 +7,11 @@
  * at all. It wraps a {@link FailoverProtectedOperation} but should that operation throw {@link FailoverException} this
  * support class simply re-raises that exception as an IllegalStateException. This support wrapper should only be
  * used where the caller can be certain that the failover protected operation cannot acutally throw a failover exception,
- * for example, because the caller already holds locks preventing that condition from arising.
+ * for example, because the caller already holds a lock preventing that condition from arising.
  *
  * <p><table id="crc"><caption>CRC Card</caption>
  * <tr><th> Responsibilities <th> Collaborations
- * <tr><td> Perform a fail-over protected operation with no handling of fail-over conditions.
+ * <tr><td> Perform a fail-over protected operation raising providing no handling of fail-over conditions.
  * </table>
  */
 public class FailoverNoopSupport<T, E extends Exception> implements FailoverSupport<T, E>
@@ -48,7 +48,7 @@
         catch (FailoverException e)
         {
             throw new IllegalStateException("Fail-over interupted no-op failover support. "
-                + "No-op support should only be used where the caller is certaing fail-over cannot occur.", e);
+                + "No-op support should only be used where the caller is certain fail-over cannot occur.", e);
         }
     }
 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverProtectedOperation.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverProtectedOperation.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverProtectedOperation.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverProtectedOperation.java Mon Jun 11 09:43:57 2007
@@ -1,7 +1,5 @@
 package org.apache.qpid.client.failover;
 
-import org.apache.qpid.AMQException;
-
 /**
  * FailoverProtectedOperation is a continuation for an operation that may throw a {@link FailoverException} because
  * it has been interrupted by the fail-over process. The {@link FailoverRetrySupport} class defines support wrappers

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverRetrySupport.java Mon Jun 11 09:43:57 2007
@@ -20,12 +20,10 @@
  */
 package org.apache.qpid.client.failover;
 
-import org.apache.log4j.Logger;
-
-import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQConnection;
 
-import javax.jms.JMSException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * FailoverRetrySupport is a continuation that wraps another continuation, delaying its execution until it is notified
@@ -72,7 +70,7 @@
 public class FailoverRetrySupport<T, E extends Exception> implements FailoverSupport<T, E>
 {
     /** Used for debugging. */
-    private static final Logger _log = Logger.getLogger(FailoverRetrySupport.class);
+    private static final Logger _log = LoggerFactory.getLogger(FailoverRetrySupport.class);
 
     /** The protected operation that is to be retried in the event of fail-over. */
     FailoverProtectedOperation<T, E> operation;
@@ -97,7 +95,7 @@
      *
      * @return The result of executing the continuation.
      *
-     * @throws AMQException Any underlying exception is allowed to fall through.
+     * @throws E Any underlying exception is allowed to fall through.
      */
     public T execute() throws E
     {

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverState.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverState.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverState.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverState.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -21,27 +21,42 @@
 package org.apache.qpid.client.failover;
 
 /**
- * Enumeration of failover states. Used to handle failover from within AMQProtocolHandler where MINA events need to be
- * dealt with and can happen during failover.
+ * Defines the possible states of the failover process; not started, in progress, failed.
+ *
+ * <p/><table id="crc"><caption>CRC Card</caption>
+ * <tr><th> Responsibilities <th> Collaborations
+ * <tr><td> Represent a one of the states of the fail-over process.
+ * </table>
  */
 public final class FailoverState
 {
+    /** The string description on this state. */
     private final String _state;
 
-    /** Failover has not yet been attempted on this connection */
+    /** Failover has not yet been attempted on this connection. */
     public static final FailoverState NOT_STARTED = new FailoverState("NOT STARTED");
 
-    /** Failover has been requested on this connection but has not completed */
+    /** Failover has been requested on this connection but has not completed. */
     public static final FailoverState IN_PROGRESS = new FailoverState("IN PROGRESS");
 
-    /** Failover has been attempted and failed */
+    /** Failover has been attempted and failed. */
     public static final FailoverState FAILED = new FailoverState("FAILED");
 
+    /**
+     * Creates a type safe enumeration of a fail-over state.
+     *
+     * @param state The fail-over state description string.
+     */
     private FailoverState(String state)
     {
         _state = state;
     }
 
+    /**
+     * Prints this state, mainly for debugging purposes.
+     *
+     * @return The string description of this state.
+     */
     public String toString()
     {
         return "FailoverState: " + _state;

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverSupport.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverSupport.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverSupport.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/failover/FailoverSupport.java Mon Jun 11 09:43:57 2007
@@ -1,7 +1,5 @@
 package org.apache.qpid.client.failover;
 
-import org.apache.qpid.client.AMQConnection;
-
 /**
  * FailoverSupport defines an interface for different types of fail-over handlers, that provide different types of
  * behaviour for handling fail-overs during operations that can be interrupted by the fail-over process. For example,

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicCancelOkMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicCancelOkMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicCancelOkMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicCancelOkMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
 import org.apache.qpid.client.state.AMQStateManager;
@@ -28,9 +27,13 @@
 import org.apache.qpid.framing.BasicCancelOkBody;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class BasicCancelOkMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _logger = Logger.getLogger(BasicCancelOkMethodHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(BasicCancelOkMethodHandler.class);
+
     private static final BasicCancelOkMethodHandler _instance = new BasicCancelOkMethodHandler();
 
     public static BasicCancelOkMethodHandler getInstance()
@@ -39,10 +42,10 @@
     }
 
     private BasicCancelOkMethodHandler()
-    {
-    }
+    { }
 
-    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
     {
         BasicCancelOkBody body = (BasicCancelOkBody) evt.getMethod();
 

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicDeliverMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicDeliverMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicDeliverMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicDeliverMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.message.UnprocessedMessage;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
@@ -29,9 +28,12 @@
 import org.apache.qpid.framing.BasicDeliverBody;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class BasicDeliverMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _logger = Logger.getLogger(BasicDeliverMethodHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(BasicDeliverMethodHandler.class);
 
     private static final BasicDeliverMethodHandler _instance = new BasicDeliverMethodHandler();
 
@@ -40,7 +42,8 @@
         return _instance;
     }
 
-    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
     {
         final UnprocessedMessage msg = new UnprocessedMessage(evt.getChannelId(), (BasicDeliverBody) evt.getMethod());
         _logger.debug("New JmsDeliver method received");

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicReturnMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicReturnMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicReturnMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/BasicReturnMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.message.UnprocessedMessage;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
@@ -29,9 +28,12 @@
 import org.apache.qpid.framing.BasicReturnBody;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class BasicReturnMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _logger = Logger.getLogger(BasicReturnMethodHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(BasicReturnMethodHandler.class);
 
     private static final BasicReturnMethodHandler _instance = new BasicReturnMethodHandler();
 
@@ -40,10 +42,11 @@
         return _instance;
     }
 
-    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
     {
         _logger.debug("New JmsBounce method received");
-        final UnprocessedMessage msg = new UnprocessedMessage(evt.getChannelId(),(BasicReturnBody)evt.getMethod());
+        final UnprocessedMessage msg = new UnprocessedMessage(evt.getChannelId(), (BasicReturnBody) evt.getMethod());
 
         protocolSession.unprocessedMessageReceived(msg);
     }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQChannelClosedException;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.AMQInvalidRoutingKeyException;
@@ -36,9 +35,12 @@
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ChannelCloseMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _logger = Logger.getLogger(ChannelCloseMethodHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(ChannelCloseMethodHandler.class);
 
     private static ChannelCloseMethodHandler _handler = new ChannelCloseMethodHandler();
 
@@ -47,7 +49,8 @@
         return _handler;
     }
 
-    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
     {
         _logger.debug("ChannelClose method received");
         ChannelCloseBody method = (ChannelCloseBody) evt.getMethod();
@@ -68,6 +71,7 @@
             {
                 _logger.debug("Channel close received with errorCode " + errorCode + ", and reason " + reason);
             }
+
             if (errorCode == AMQConstant.NO_CONSUMERS)
             {
                 throw new AMQNoConsumersException("Error: " + reason, null);
@@ -94,7 +98,7 @@
             }
 
         }
-        //fixme why is this only done when the close is expected...
+        // fixme why is this only done when the close is expected...
         // should the above forced closes not also cause a close?
         protocolSession.channelClosed(evt.getChannelId(), errorCode, String.valueOf(reason));
     }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseOkMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseOkMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseOkMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelCloseOkMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,16 +20,18 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
 import org.apache.qpid.client.state.AMQStateManager;
 import org.apache.qpid.client.state.StateAwareMethodListener;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ChannelCloseOkMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _logger = Logger.getLogger(ChannelCloseOkMethodHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(ChannelCloseOkMethodHandler.class);
 
     private static final ChannelCloseOkMethodHandler _instance = new ChannelCloseOkMethodHandler();
 
@@ -38,10 +40,11 @@
         return _instance;
     }
 
-    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
     {
         _logger.info("Received channel-close-ok for channel-id " + evt.getChannelId());
 
-        //todo this should do the local closure
+        // todo this should do the local closure
     }
 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelFlowOkMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelFlowOkMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelFlowOkMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ChannelFlowOkMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
 import org.apache.qpid.client.state.AMQStateManager;
@@ -28,23 +27,26 @@
 import org.apache.qpid.framing.ChannelFlowOkBody;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ChannelFlowOkMethodHandler implements StateAwareMethodListener
 {
-     private static final Logger _logger = Logger.getLogger(ChannelFlowOkMethodHandler.class);
-     private static final ChannelFlowOkMethodHandler _instance = new ChannelFlowOkMethodHandler();
+    private static final Logger _logger = LoggerFactory.getLogger(ChannelFlowOkMethodHandler.class);
+    private static final ChannelFlowOkMethodHandler _instance = new ChannelFlowOkMethodHandler();
+
+    public static ChannelFlowOkMethodHandler getInstance()
+    {
+        return _instance;
+    }
+
+    private ChannelFlowOkMethodHandler()
+    { }
 
-     public static ChannelFlowOkMethodHandler getInstance()
-     {
-         return _instance;
-     }
-
-     private ChannelFlowOkMethodHandler()
-     {
-     }
-
-     public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
-     {
-         ChannelFlowOkBody method = (ChannelFlowOkBody) evt.getMethod();
-         _logger.debug("Received Channel.Flow-Ok message, active = " + method.active);
-     }
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
+    {
+        ChannelFlowOkBody method = (ChannelFlowOkBody) evt.getMethod();
+        _logger.debug("Received Channel.Flow-Ok message, active = " + method.active);
+    }
 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionCloseMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQConnectionClosedException;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.AMQAuthenticationException;
@@ -34,9 +33,12 @@
 import org.apache.qpid.protocol.AMQConstant;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ConnectionCloseMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _logger = Logger.getLogger(ConnectionCloseMethodHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(ConnectionCloseMethodHandler.class);
 
     private static ConnectionCloseMethodHandler _handler = new ConnectionCloseMethodHandler();
 
@@ -46,16 +48,16 @@
     }
 
     private ConnectionCloseMethodHandler()
-    {
-    }
+    { }
 
-    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
     {
         _logger.info("ConnectionClose frame received");
         ConnectionCloseBody method = (ConnectionCloseBody) evt.getMethod();
 
         // does it matter
-        //stateManager.changeState(AMQState.CONNECTION_CLOSING);
+        // stateManager.changeState(AMQState.CONNECTION_CLOSING);
 
         AMQConstant errorCode = AMQConstant.getConstant(method.replyCode);
         AMQShortString reason = method.replyText;
@@ -64,7 +66,8 @@
         {
             // TODO: check whether channel id of zero is appropriate
             // Be aware of possible changes to parameter order as versions change.
-            protocolSession.writeFrame(ConnectionCloseOkBody.createAMQFrame((short) 0, method.getMajor(), method.getMinor()));
+            protocolSession.writeFrame(ConnectionCloseOkBody.createAMQFrame((short) 0, method.getMajor(),
+                    method.getMinor()));
 
             if (errorCode != AMQConstant.REPLY_SUCCESS)
             {
@@ -74,15 +77,14 @@
 
                     protocolSession.closeProtocolSession();
 
-                    //todo this is a bit of a fudge (could be conssidered such as each new connection needs a new state manager or at least a fresh state.
+                    // todo this is a bit of a fudge (could be conssidered such as each new connection needs a new state manager or at least a fresh state.
                     stateManager.changeState(AMQState.CONNECTION_NOT_STARTED);
 
-                    throw new AMQAuthenticationException(errorCode, reason == null ? null : reason.toString());
+                    throw new AMQAuthenticationException(errorCode, (reason == null) ? null : reason.toString());
                 }
                 else
                 {
                     _logger.info("Connection close received with error code " + errorCode);
-
 
                     throw new AMQConnectionClosedException(errorCode, "Error: " + reason);
                 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionRedirectMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionRedirectMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionRedirectMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionRedirectMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -20,7 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
 import org.apache.qpid.client.state.AMQStateManager;
@@ -28,9 +27,12 @@
 import org.apache.qpid.framing.ConnectionRedirectBody;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 public class ConnectionRedirectMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _logger = Logger.getLogger(ConnectionRedirectMethodHandler.class);
+    private static final Logger _logger = LoggerFactory.getLogger(ConnectionRedirectMethodHandler.class);
 
     private static final int DEFAULT_REDIRECT_PORT = 5672;
 
@@ -42,10 +44,10 @@
     }
 
     private ConnectionRedirectMethodHandler()
-    {
-    }
+    { }
 
-    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt) throws AMQException
+    public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
+        throws AMQException
     {
         _logger.info("ConnectionRedirect frame received");
         ConnectionRedirectBody method = (ConnectionRedirectBody) evt.getMethod();
@@ -65,6 +67,7 @@
             host = host.substring(0, portIndex);
 
         }
+
         protocolSession.failover(host, port);
     }
 }

Modified: incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java?view=diff&rev=546190&r1=546189&r2=546190
==============================================================================
--- incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java (original)
+++ incubator/qpid/branches/M2/java/client/src/main/java/org/apache/qpid/client/handler/ConnectionStartMethodHandler.java Mon Jun 11 09:43:57 2007
@@ -20,16 +20,6 @@
  */
 package org.apache.qpid.client.handler;
 
-import java.io.UnsupportedEncodingException;
-import java.util.HashSet;
-import java.util.StringTokenizer;
-
-import javax.security.sasl.Sasl;
-import javax.security.sasl.SaslClient;
-import javax.security.sasl.SaslException;
-
-import org.apache.log4j.Logger;
-
 import org.apache.qpid.AMQException;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
 import org.apache.qpid.client.security.AMQCallbackHandler;
@@ -47,9 +37,20 @@
 import org.apache.qpid.framing.ProtocolVersion;
 import org.apache.qpid.protocol.AMQMethodEvent;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.security.sasl.Sasl;
+import javax.security.sasl.SaslClient;
+import javax.security.sasl.SaslException;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashSet;
+import java.util.StringTokenizer;
+
 public class ConnectionStartMethodHandler implements StateAwareMethodListener
 {
-    private static final Logger _log = Logger.getLogger(ConnectionStartMethodHandler.class);
+    private static final Logger _log = LoggerFactory.getLogger(ConnectionStartMethodHandler.class);
 
     private static final ConnectionStartMethodHandler _instance = new ConnectionStartMethodHandler();
 
@@ -62,15 +63,14 @@
     { }
 
     public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, AMQMethodEvent evt)
-                        throws AMQException
+        throws AMQException
     {
         _log.debug("public void methodReceived(AMQStateManager stateManager, AMQProtocolSession protocolSession, "
-                   + "AMQMethodEvent evt): called");
+            + "AMQMethodEvent evt): called");
 
         ConnectionStartBody body = (ConnectionStartBody) evt.getMethod();
 
-        ProtocolVersion pv = new ProtocolVersion((byte) body.versionMajor,(byte) body.versionMinor);
-
+        ProtocolVersion pv = new ProtocolVersion((byte) body.versionMajor, (byte) body.versionMinor);
 
         // For the purposes of interop, we can make the client accept the broker's version string.
         // If it does, it then internally records the version as being the latest one that it understands.
@@ -110,7 +110,7 @@
                 {
                     SaslClient sc =
                         Sasl.createSaslClient(new String[] { mechanism }, null, "AMQP", "localhost", null,
-                                              createCallbackHandler(mechanism, protocolSession));
+                            createCallbackHandler(mechanism, protocolSession));
                     if (sc == null)
                     {
                         throw new AMQException(
@@ -149,23 +149,22 @@
                 FieldTable clientProperties = FieldTableFactory.newFieldTable();
 
                 clientProperties.setString(new AMQShortString(ClientProperties.instance.toString()),
-                                           protocolSession.getClientID());
+                    protocolSession.getClientID());
                 clientProperties.setString(new AMQShortString(ClientProperties.product.toString()),
-                                           QpidProperties.getProductName());
+                    QpidProperties.getProductName());
                 clientProperties.setString(new AMQShortString(ClientProperties.version.toString()),
-                                           QpidProperties.getReleaseVersion());
+                    QpidProperties.getReleaseVersion());
                 clientProperties.setString(new AMQShortString(ClientProperties.platform.toString()), getFullSystemInfo());
 
                 // AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
                 // TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
                 // Be aware of possible changes to parameter order as versions change.
                 protocolSession.writeFrame(ConnectionStartOkBody.createAMQFrame(evt.getChannelId(),
-                                                                                protocolSession.getProtocolMajorVersion(),
-                                                                                protocolSession.getProtocolMinorVersion(),
-                                                                                clientProperties, // clientProperties
-                                                                                new AMQShortString(selectedLocale), // locale
-                                                                                new AMQShortString(mechanism), // mechanism
-                                                                                saslResponse)); // response
+                        protocolSession.getProtocolMajorVersion(), protocolSession.getProtocolMinorVersion(),
+                        clientProperties, // clientProperties
+                        new AMQShortString(selectedLocale), // locale
+                        new AMQShortString(mechanism), // mechanism
+                        saslResponse)); // response
 
             }
             catch (UnsupportedEncodingException e)
@@ -176,13 +175,12 @@
         else
         {
             _log.error("Broker requested Protocol [" + body.versionMajor + "-" + body.versionMinor
-                       + "] which is not supported by this version of the client library");
+                + "] which is not supported by this version of the client library");
 
             protocolSession.closeProtocolSession();
         }
     }
 
-  
     private String getFullSystemInfo()
     {
         StringBuffer fullSystemInfo = new StringBuffer();
@@ -222,7 +220,7 @@
     }
 
     private AMQCallbackHandler createCallbackHandler(String mechanism, AMQProtocolSession protocolSession)
-                                              throws AMQException
+        throws AMQException
     {
         Class mechanismClass = CallbackHandlerRegistry.getInstance().getCallbackHandlerClass(mechanism);
         try