Skip to content

Commit f7e98bb

Browse files
author
Matthew Sackman
committed
Moving around, tidying up, documentation
1 parent 9f38faa commit f7e98bb

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

src/com/rabbitmq/client/Consumer.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ public interface Consumer {
4949
*/
5050
void handleCancelOk(String consumerTag);
5151

52+
/**
53+
* Called when the consumer is cancelled for reasons other than by a
54+
* basicCancel: e.g. the queue is deleted. See handleCancelOk for
55+
* notification of consumer cancellation due to basicCancel.
56+
*
57+
* @throws IOException
58+
*/
59+
void handleCancel(String consumerTag) throws IOException;
60+
5261
/**
5362
* Called to the consumer that either the channel or the undelying connection has been shut down.
5463
* @param consumerTag the defined consumerTag (either client- or server-generated)
@@ -82,6 +91,4 @@ void handleDelivery(String consumerTag,
8291
AMQP.BasicProperties properties,
8392
byte[] body)
8493
throws IOException;
85-
86-
void handleCancelNotification() throws IOException;
8794
}

src/com/rabbitmq/client/DefaultConsumer.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public void handleCancelOk(String consumerTag) {
5353
// no work to do
5454
}
5555

56+
/**
57+
* No-op implementation of {@link Consumer#handleCancel(String)}
58+
* @param consumerTag the defined consumer tag (client- or server-generated)
59+
*/
60+
public void handleCancel(String consumerTag) throws IOException {
61+
// no work to do
62+
}
63+
5664
/**
5765
* No-op implementation of {@link Consumer#handleShutdownSignal}.
5866
*/
@@ -79,10 +87,6 @@ public void handleDelivery(String consumerTag,
7987
// no work to do
8088
}
8189

82-
public void handleCancelNotification() throws IOException {
83-
// no work to do
84-
}
85-
8690
/**
8791
* Retrieve the channel.
8892
* @return the channel this consumer is attached to.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,12 @@ public void releaseChannelNumber() {
347347
}
348348
if (callback != null) {
349349
try {
350-
callback.handleCancelNotification();
350+
callback.handleCancel(m.getConsumerTag());
351351
} catch (Throwable ex) {
352352
_connection.getExceptionHandler().handleConsumerException(this,
353353
ex,
354354
callback,
355-
m.consumerTag,
355+
m.getConsumerTag(),
356356
"handleCancelNotification");
357357
}
358358
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ public void handleConsumerException(Channel channel, Throwable exception,
5555
+ " for channel " + channel);
5656
}
5757

58-
public void handleConsumerCancellationException(Channel channel,
59-
Throwable exception) {
60-
handleChannelKiller(channel, exception, "ConsumerCancellationListener.handleConsumerCancellation");
61-
62-
}
63-
6458
protected void handleChannelKiller(Channel channel,
6559
Throwable exception,
6660
String what)

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,4 @@ void handleConsumerException(Channel channel,
7878
Consumer consumer,
7979
String consumerTag,
8080
String methodName);
81-
8281
}

test/src/com/rabbitmq/client/test/functional/ConsumerCancelNotificiation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public void testConsumerCancellationNotification() throws IOException {
4646
channel.queueDeclare(queue, false, true, false, null);
4747
Consumer consumer = new QueueingConsumer(channel) {
4848
@Override
49-
public void handleCancelNotification() throws IOException {
49+
public void handleCancel(String consumerTag) throws IOException {
5050
synchronized (lock) {
5151
notified = !notified;
5252
lock.notifyAll();

0 commit comments

Comments
 (0)