Skip to content

Commit 803dd48

Browse files
author
Hubert Plociniczak
committed
Fixed various inconsistencies in the Connection
and Channel javadocs. Implementation methods now import javadocs from corresponding interfaces.
1 parent 63780af commit 803dd48

File tree

5 files changed

+40
-72
lines changed

5 files changed

+40
-72
lines changed

src/com/rabbitmq/client/Channel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ public interface Channel extends ShutdownNotifier{
7070
Connection getConnection();
7171

7272
/**
73-
* Close this channel with the default close code and message.
73+
* Close this channel with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
74+
* and message 'OK'.
7475
*
7576
* @throws java.io.IOException if an error is encountered
7677
*/

src/com/rabbitmq/client/Connection.java

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,10 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
122122

123123
/**
124124
* Close this connection and all its channels
125-
* with the default close code and message.
125+
* with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
126+
* and message 'OK'.
126127
*
127-
* This method will wait infinitely for all the close operations to
128-
* complete.
128+
* Waits for all the close operations to complete.
129129
*
130130
* @throws IOException if an I/O problem is encountered
131131
*/
@@ -134,8 +134,7 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
134134
/**
135135
* Close this connection and all its channels.
136136
*
137-
* This method will wait infinitely for all the close operations to
138-
* complete.
137+
* Waits for all the close operations to complete.
139138
*
140139
* @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
141140
* @param closeMessage a message indicating the reason for closing the connection
@@ -145,11 +144,12 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
145144

146145
/**
147146
* Close this connection and all its channels
148-
* with the default close code and message.
149-
*
150-
* This method will wait with the given timeout for all the close
151-
* operations to complete. If timeout is reached then socket is forced
152-
* to close.
147+
* with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
148+
* and message 'OK'.
149+
*
150+
* This method behaves in a similar way as {@link #close()}, with the only difference
151+
* that it waits with a provided timeout for all the close operations to
152+
* complete. When timeout is reached the socket is forced to close.
153153
*
154154
* @param timeout timeout (in milliseconds) for completing all the close-related
155155
* operations, use -1 for infinity
@@ -160,9 +160,8 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
160160
/**
161161
* Close this connection and all its channels.
162162
*
163-
* This method will wait with the given timeout for all the close
164-
* operations to complete. If timeout is reached then socket is forced
165-
* to close.
163+
* Waits with the given timeout for all the close operations to complete.
164+
* When timeout is reached the socket is forced to close.
166165
*
167166
* @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
168167
* @param closeMessage a message indicating the reason for closing the connection
@@ -174,18 +173,19 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
174173

175174
/**
176175
* Abort this connection and all its channels
177-
* with the default code and message.
176+
* with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
177+
* and message 'OK'.
178178
*
179-
* This method will force the connection to close. It will silently discard
180-
* any exceptions encountered in close operations.
179+
* Forces the connection to close.
180+
* Any encountered exceptions in the close operations are silently discarded.
181181
*/
182182
void abort();
183183

184184
/**
185185
* Abort this connection and all its channels.
186186
*
187-
* This method will force the connection to close. It will silently discard
188-
* any exceptions encountered in close operations.
187+
* Forces the connection to close and waits for all the close operations to complete.
188+
* Any encountered exceptions in the close operations are silently discarded.
189189
*
190190
* @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
191191
* @param closeMessage a message indicating the reason for closing the connection
@@ -194,11 +194,12 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
194194

195195
/**
196196
* Abort this connection and all its channels
197-
* with the default close code and message.
197+
* with the {@link com.rabbitmq.client.AMQP#REPLY_SUCCESS} close code
198+
* and message 'OK'.
198199
*
199-
* This method behaves in a similar way as abort(), with the only difference
200-
* that it will wait with a provided timeout for all the close operations to
201-
* complete. If timeout is reached socket is forced to close.
200+
* This method behaves in a similar way as {@link #abort()}, with the only difference
201+
* that it waits with a provided timeout for all the close operations to
202+
* complete. When timeout is reached the socket is forced to close.
202203
*
203204
* @param timeout timeout (in milliseconds) for completing all the close-related
204205
* operations, use -1 for infinity
@@ -208,9 +209,10 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
208209
/**
209210
* Abort this connection and all its channels.
210211
*
211-
* This method behaves in a similar way as abort(), with the only difference
212-
* that it will wait with a provided timeout for all the close operations to
213-
* complete. If timeout is reached socket is forced to close.
212+
* Forces the connection to close and waits with the given timeout
213+
* for all the close operations to complete. When timeout is reached
214+
* the socket is forced to close.
215+
* Any encountered exceptions in the close operations are silently discarded.
214216
*
215217
* @param closeCode the close code (See under "Reply Codes" in the AMQP specification)
216218
* @param closeMessage a message indicating the reason for closing the connection

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
* int ticket = ch1.accessRequest(realmName);
6363
* </pre>
6464
*/
65-
public class AMQConnection extends ShutdownNotifierComponent implements Connection{
65+
public class AMQConnection extends ShutdownNotifierComponent implements Connection {
6666
/** Timeout used while waiting for AMQP handshaking to complete (milliseconds) */
6767
public static final int HANDSHAKE_TIMEOUT = 10000;
6868

@@ -617,75 +617,45 @@ public void shutdown(Object reason,
617617
_channelManager.handleSignal(_shutdownCause);
618618
}
619619

620-
/**
621-
* Public API - Close this connection and all its channels.
622-
*/
623620
public void close()
624621
throws IOException
625622
{
626623
close(-1);
627624
}
628625

629-
/**
630-
* Public API - Close this connection and all its channels
631-
* with a given timeout.
632-
*/
633626
public void close(int timeout)
634627
throws IOException
635628
{
636-
close(AMQP.REPLY_SUCCESS, "Goodbye", timeout);
629+
close(AMQP.REPLY_SUCCESS, "OK", timeout);
637630
}
638-
639-
/**
640-
* Public API - Close this connection and all its channels
641-
* with a given close code and message.
642-
*/
631+
643632
public void close(int closeCode, String closeMessage)
644633
throws IOException
645634
{
646635
close(closeCode, closeMessage, -1);
647636
}
648637

649-
/**
650-
* Public API - Close this connection and all its channels
651-
* with a given close code, message and timeout.
652-
*/
653638
public void close(int closeCode, String closeMessage, int timeout)
654639
throws IOException
655640
{
656641
close(closeCode, closeMessage, true, null, timeout, false);
657642
}
658643

659-
/**
660-
* Public API - Abort this connection and all its channels.
661-
*/
662644
public void abort()
663645
{
664646
abort(-1);
665647
}
666648

667-
/**
668-
* Public API - Abort this connection and all its channels
669-
* with a given close code and message.
670-
*/
671649
public void abort(int closeCode, String closeMessage)
672650
{
673651
abort(closeCode, closeMessage, -1);
674652
}
675653

676-
/**
677-
* Public API - Abort this connection and all its channels
678-
* with a given timeout.
679-
*/
680654
public void abort(int timeout)
681655
{
682-
abort(AMQP.REPLY_SUCCESS, "Goodbye", timeout);
656+
abort(AMQP.REPLY_SUCCESS, "OK", timeout);
683657
}
684-
685-
/**
686-
* Public API - Abort this connection and all its channels
687-
* with a given close code, message and timeout.
688-
*/
658+
689659
public void abort(int closeCode, String closeMessage, int timeout)
690660
{
691661
try {
@@ -705,7 +675,9 @@ public void close(int closeCode,
705675
}
706676

707677
/**
708-
* Protected API - Close this connection with the given code, message and source.
678+
* Protected API - Close this connection with the given code, message, source
679+
* and timeout value for all the close operations to complete.
680+
* Specifies if any encountered exceptions should be ignored.
709681
*/
710682
public void close(int closeCode,
711683
String closeMessage,

src/com/rabbitmq/client/impl/ChannelN.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,12 @@ public void releaseChannelNumber() {
249249
}
250250
}
251251

252-
253-
/**
254-
* Public API - Close this channel with the default close code and message.
255-
*/
256252
public void close()
257253
throws IOException
258254
{
259-
close(AMQP.REPLY_SUCCESS, "Goodbye");
255+
close(AMQP.REPLY_SUCCESS, "OK");
260256
}
261257

262-
/**
263-
* Public API - Close this channel.
264-
*/
265258
public void close(int closeCode, String closeMessage)
266259
throws IOException
267260
{

test/src/com/rabbitmq/examples/SpammyTopicProducer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public static void main(String[] args) {
9292
}
9393
}
9494

95-
//ch.close(200, "Closing the channel");
96-
//conn.close(200, "Closing the connection");
95+
//ch.close();
96+
//conn.close();
9797
} catch (Exception e) {
9898
System.err.println("Main thread caught exception: " + e);
9999
e.printStackTrace();

0 commit comments

Comments
 (0)