Skip to content

Commit fd9def6

Browse files
committed
Slight layout normalization and additional sanity check.
1 parent cfd541d commit fd9def6

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/com/rabbitmq/client/QueueingConsumer.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public QueueingConsumer(Channel ch) {
5959
this(ch, new LinkedBlockingQueue<Delivery>());
6060
}
6161

62-
public QueueingConsumer(Channel ch, BlockingQueue<Delivery> q)
63-
{
62+
public QueueingConsumer(Channel ch, BlockingQueue<Delivery> q) {
6463
super(ch);
6564
this._queue = q;
6665
}
6766

68-
@Override public void handleShutdownSignal(String consumerTag, ShutdownSignalException sig) {
67+
@Override public void handleShutdownSignal(String consumerTag,
68+
ShutdownSignalException sig) {
6969
_shutdown = sig;
7070
_queue.add(POISON);
7171
}
@@ -122,22 +122,26 @@ public byte[] getBody() {
122122
/**
123123
* Check if we are in shutdown mode and if so throw an exception.
124124
*/
125-
private void checkShutdown(){
126-
if(_shutdown != null) throw Utility.fixStackTrace(_shutdown);
125+
private void checkShutdown() {
126+
if (_shutdown != null)
127+
throw Utility.fixStackTrace(_shutdown);
127128
}
128129

129130
/**
130131
* If this is a non-POISON non-null delivery simply return it.
131132
* If this is POISON we are in shutdown mode, throw _shutdown
132133
* If this is null, we may be in shutdown mode. Check and see.
133134
*/
134-
private Delivery handle(Delivery delivery)
135-
{
136-
if(delivery == POISON || (delivery == null && _shutdown != null)){
137-
if(delivery == POISON) _queue.add(POISON);
138-
throw Utility.fixStackTrace(_shutdown);
139-
}
140-
return delivery;
135+
private Delivery handle(Delivery delivery) {
136+
if (delivery == POISON ||
137+
delivery == null && _shutdown != null) {
138+
if (delivery == POISON) {
139+
_queue.add(POISON);
140+
assert _shutdown != null;
141+
}
142+
throw Utility.fixStackTrace(_shutdown);
143+
}
144+
return delivery;
141145
}
142146

143147
/**

0 commit comments

Comments
 (0)