Fixed various inconsistencies in the Connection bug19470
authorHubert Plociniczak <hubert@lshift.net>
Mon Oct 20 01:07:53 2008 +0100 (2008-10-20)
branchbug19470
changeset 152fe4cf0a19b86
parent 151 560664f7d699
child 154 a7dd16cd045e
Fixed various inconsistencies in the Connection
and Channel javadocs. Implementation methods now
import javadocs from corresponding interfaces.
src/com/rabbitmq/client/Channel.java
src/com/rabbitmq/client/Connection.java
src/com/rabbitmq/client/impl/AMQConnection.java
src/com/rabbitmq/client/impl/ChannelN.java
test/src/com/rabbitmq/examples/SpammyTopicProducer.java
     1.1 --- a/src/com/rabbitmq/client/Channel.java	Sun Oct 19 23:15:02 2008 +0100
     1.2 +++ b/src/com/rabbitmq/client/Channel.java	Mon Oct 20 01:07:53 2008 +0100
     1.3 @@ -70,7 +70,8 @@
     1.4      Connection getConnection();
     1.5  
     1.6      /**
     1.7 -     * Close this channel with the default close code and message.
     1.8 +     * Close this channel with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
     1.9 +     * and message 'OK'.
    1.10       * 
    1.11       * @throws java.io.IOException if an error is encountered
    1.12       */
     2.1 --- a/src/com/rabbitmq/client/Connection.java	Sun Oct 19 23:15:02 2008 +0100
     2.2 +++ b/src/com/rabbitmq/client/Connection.java	Mon Oct 20 01:07:53 2008 +0100
     2.3 @@ -122,10 +122,10 @@
     2.4  
     2.5      /**
     2.6       * Close this connection and all its channels
     2.7 -     * with the default close code and message.
     2.8 +     * with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
     2.9 +     * and message 'OK'.
    2.10       *
    2.11 -     * This method will wait infinitely for all the close operations to
    2.12 -     * complete.
    2.13 +     * Waits for all the close operations to complete.
    2.14       *
    2.15       * @throws IOException if an I/O problem is encountered
    2.16       */
    2.17 @@ -134,8 +134,7 @@
    2.18      /**
    2.19       * Close this connection and all its channels.
    2.20       *
    2.21 -     * This method will wait infinitely for all the close operations to
    2.22 -     * complete.
    2.23 +     * Waits for all the close operations to complete.
    2.24       *
    2.25       * @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
    2.26       * @param closeMessage a message indicating the reason for closing the connection
    2.27 @@ -145,11 +144,12 @@
    2.28  
    2.29      /**
    2.30       * Close this connection and all its channels
    2.31 -     * with the default close code and message.
    2.32 -     *
    2.33 -     * This method will wait with the given timeout for all the close
    2.34 -     * operations to complete. If timeout is reached then socket is forced
    2.35 -     * to close.
    2.36 +     * with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
    2.37 +     * and message 'OK'.
    2.38 +     * 
    2.39 +     * This method behaves in a similar way as {@link #close()}, with the only difference
    2.40 +     * that it waits with a provided timeout for all the close operations to
    2.41 +     * complete. When timeout is reached the socket is forced to close.
    2.42       * 
    2.43       * @param timeout timeout (in milliseconds) for completing all the close-related
    2.44       * operations, use -1 for infinity
    2.45 @@ -160,9 +160,8 @@
    2.46      /**
    2.47       * Close this connection and all its channels.
    2.48       *
    2.49 -     * This method will wait with the given timeout for all the close
    2.50 -     * operations to complete. If timeout is reached then socket is forced
    2.51 -     * to close.
    2.52 +     * Waits with the given timeout for all the close operations to complete.
    2.53 +     * When timeout is reached the socket is forced to close.
    2.54       * 
    2.55       * @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
    2.56       * @param closeMessage a message indicating the reason for closing the connection
    2.57 @@ -174,18 +173,19 @@
    2.58  
    2.59      /**
    2.60       * Abort this connection and all its channels
    2.61 -     * with the default code and message.
    2.62 +     * with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
    2.63 +     * and message 'OK'.
    2.64       *
    2.65 -     * This method will force the connection to close. It will silently discard
    2.66 -     * any exceptions encountered in close operations.
    2.67 +     * Forces the connection to close.
    2.68 +     * Any encountered exceptions in the close operations are silently discarded.
    2.69       */
    2.70      void abort();
    2.71      
    2.72      /**
    2.73       * Abort this connection and all its channels.
    2.74       *
    2.75 -     * This method will force the connection to close. It will silently discard
    2.76 -     * any exceptions encountered in close operations.
    2.77 +     * Forces the connection to close and waits for all the close operations to complete.
    2.78 +     * Any encountered exceptions in the close operations are silently discarded.
    2.79       * 
    2.80       * @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
    2.81       * @param closeMessage a message indicating the reason for closing the connection
    2.82 @@ -194,11 +194,12 @@
    2.83      
    2.84      /**
    2.85       * Abort this connection and all its channels
    2.86 -     * with the default close code and message.
    2.87 +     * with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
    2.88 +     * and message 'OK'.
    2.89       *
    2.90 -     * This method behaves in a similar way as abort(), with the only difference
    2.91 -     * that it will wait with a provided timeout for all the close operations to
    2.92 -     * complete. If timeout is reached socket is forced to close.
    2.93 +     * This method behaves in a similar way as {@link #abort()}, with the only difference
    2.94 +     * that it waits with a provided timeout for all the close operations to
    2.95 +     * complete. When timeout is reached the socket is forced to close.
    2.96       *
    2.97       * @param timeout timeout (in milliseconds) for completing all the close-related
    2.98       * operations, use -1 for infinity
    2.99 @@ -208,9 +209,10 @@
   2.100      /**
   2.101       * Abort this connection and all its channels.
   2.102       *
   2.103 -     * This method behaves in a similar way as abort(), with the only difference
   2.104 -     * that it will wait with a provided timeout for all the close operations to
   2.105 -     * complete. If timeout is reached socket is forced to close.
   2.106 +     * Forces the connection to close and waits with the given timeout
   2.107 +     * for all the close operations to complete. When timeout is reached
   2.108 +     * the socket is forced to close.
   2.109 +     * Any encountered exceptions in the close operations are silently discarded.
   2.110       *
   2.111       * @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
   2.112       * @param closeMessage a message indicating the reason for closing the connection
     3.1 --- a/src/com/rabbitmq/client/impl/AMQConnection.java	Sun Oct 19 23:15:02 2008 +0100
     3.2 +++ b/src/com/rabbitmq/client/impl/AMQConnection.java	Mon Oct 20 01:07:53 2008 +0100
     3.3 @@ -62,7 +62,7 @@
     3.4   * int ticket = ch1.accessRequest(realmName);
     3.5   * </pre>
     3.6   */
     3.7 -public class AMQConnection extends ShutdownNotifierComponent implements Connection{
     3.8 +public class AMQConnection extends ShutdownNotifierComponent implements Connection {
     3.9      /** Timeout used while waiting for AMQP handshaking to complete (milliseconds) */
    3.10      public static final int HANDSHAKE_TIMEOUT = 10000;
    3.11  
    3.12 @@ -617,75 +617,45 @@
    3.13          _channelManager.handleSignal(_shutdownCause);
    3.14      }
    3.15  
    3.16 -    /**
    3.17 -     * Public API - Close this connection and all its channels.
    3.18 -     */
    3.19      public void close()
    3.20          throws IOException
    3.21      {
    3.22          close(-1);
    3.23      }
    3.24  
    3.25 -    /**
    3.26 -     * Public API - Close this connection and all its channels
    3.27 -     * with a given timeout.
    3.28 -     */
    3.29      public void close(int timeout)
    3.30          throws IOException
    3.31      {
    3.32 -        close(AMQP.REPLY_SUCCESS, "Goodbye", timeout);
    3.33 +        close(AMQP.REPLY_SUCCESS, "OK", timeout);
    3.34      }
    3.35 -    
    3.36 -    /**
    3.37 -     * Public API - Close this connection and all its channels
    3.38 -     * with a given close code and message.
    3.39 -     */
    3.40 +
    3.41      public void close(int closeCode, String closeMessage)
    3.42          throws IOException
    3.43      {
    3.44          close(closeCode, closeMessage, -1);
    3.45      }
    3.46  
    3.47 -    /**
    3.48 -     * Public API - Close this connection and all its channels
    3.49 -     * with a given close code, message and timeout.
    3.50 -     */
    3.51      public void close(int closeCode, String closeMessage, int timeout)
    3.52          throws IOException
    3.53      {
    3.54          close(closeCode, closeMessage, true, null, timeout, false);
    3.55      }
    3.56  
    3.57 -    /**
    3.58 -     * Public API - Abort this connection and all its channels.
    3.59 -     */
    3.60      public void abort()
    3.61      {
    3.62          abort(-1);
    3.63      }
    3.64  
    3.65 -    /**
    3.66 -     * Public API - Abort this connection and all its channels
    3.67 -     * with a given close code and message.
    3.68 -     */
    3.69      public void abort(int closeCode, String closeMessage)
    3.70      {
    3.71         abort(closeCode, closeMessage, -1);
    3.72      }
    3.73  
    3.74 -    /**
    3.75 -     * Public API - Abort this connection and all its channels
    3.76 -     * with a given timeout.
    3.77 -     */
    3.78      public void abort(int timeout)
    3.79      {
    3.80 -        abort(AMQP.REPLY_SUCCESS, "Goodbye", timeout);
    3.81 +        abort(AMQP.REPLY_SUCCESS, "OK", timeout);
    3.82      }
    3.83 -    
    3.84 -    /**
    3.85 -     * Public API - Abort this connection and all its channels
    3.86 -     * with a given close code, message and timeout.
    3.87 -     */
    3.88 +
    3.89      public void abort(int closeCode, String closeMessage, int timeout)
    3.90      {
    3.91          try {
    3.92 @@ -705,7 +675,9 @@
    3.93      }
    3.94  
    3.95      /**
    3.96 -     * Protected API - Close this connection with the given code, message and source.
    3.97 +     * Protected API - Close this connection with the given code, message, source
    3.98 +     * and timeout value for all the close operations to complete.
    3.99 +     * Specifies if any encountered exceptions should be ignored.
   3.100       */
   3.101      public void close(int closeCode,
   3.102                        String closeMessage,
     4.1 --- a/src/com/rabbitmq/client/impl/ChannelN.java	Sun Oct 19 23:15:02 2008 +0100
     4.2 +++ b/src/com/rabbitmq/client/impl/ChannelN.java	Mon Oct 20 01:07:53 2008 +0100
     4.3 @@ -249,19 +249,12 @@
     4.4          }
     4.5      }
     4.6  
     4.7 -
     4.8 -    /**
     4.9 -     * Public API - Close this channel with the default close code and message.
    4.10 -     */
    4.11      public void close()
    4.12          throws IOException
    4.13      {
    4.14 -        close(AMQP.REPLY_SUCCESS, "Goodbye");
    4.15 +        close(AMQP.REPLY_SUCCESS, "OK");
    4.16      }
    4.17      
    4.18 -    /**
    4.19 -     * Public API - Close this channel.
    4.20 -     */
    4.21      public void close(int closeCode, String closeMessage)
    4.22          throws IOException
    4.23      {
     5.1 --- a/test/src/com/rabbitmq/examples/SpammyTopicProducer.java	Sun Oct 19 23:15:02 2008 +0100
     5.2 +++ b/test/src/com/rabbitmq/examples/SpammyTopicProducer.java	Mon Oct 20 01:07:53 2008 +0100
     5.3 @@ -92,8 +92,8 @@
     5.4                  }
     5.5              }
     5.6  
     5.7 -            //ch.close(200, "Closing the channel");
     5.8 -            //conn.close(200, "Closing the connection");
     5.9 +            //ch.close();
    5.10 +            //conn.close();
    5.11          } catch (Exception e) {
    5.12              System.err.println("Main thread caught exception: " + e);
    5.13              e.printStackTrace();