Package com.rabbitmq.client.impl
Class ConsumerDispatcher
- java.lang.Object
-
- com.rabbitmq.client.impl.ConsumerDispatcher
-
final class ConsumerDispatcher extends java.lang.Object
Dispatches notifications to aConsumer
on an internally-managed executor service and work pool. EachChannel
has a singleConsumerDispatcher
, but the executor service and work pool may be shared with other channels, typically those on the sameAMQConnection
.
-
-
Field Summary
Fields Modifier and Type Field Description private Channel
channel
private AMQConnection
connection
private java.util.concurrent.CountDownLatch
shutdownConsumersComplete
private boolean
shutdownConsumersDriven
private ShutdownSignalException
shutdownSignal
private boolean
shuttingDown
private ConsumerWorkService
workService
-
Constructor Summary
Constructors Constructor Description ConsumerDispatcher(AMQConnection connection, Channel channel, ConsumerWorkService workService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkShutdown()
private void
execute(java.lang.Runnable r)
private void
executeUnlessShuttingDown(java.lang.Runnable r)
void
handleCancel(Consumer delegate, java.lang.String consumerTag)
void
handleCancelOk(Consumer delegate, java.lang.String consumerTag)
void
handleConsumeOk(Consumer delegate, java.lang.String consumerTag)
void
handleDelivery(Consumer delegate, java.lang.String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
void
handleRecoverOk(Consumer delegate, java.lang.String consumerTag)
java.util.concurrent.CountDownLatch
handleShutdownSignal(java.util.Map<java.lang.String,Consumer> consumers, ShutdownSignalException signal)
private void
notifyConsumerOfShutdown(java.lang.String consumerTag, Consumer consumer, ShutdownSignalException signal)
private void
notifyConsumersOfShutdown(java.util.Map<java.lang.String,Consumer> consumers, ShutdownSignalException signal)
void
quiesce()
Prepare for shutdown of all consumers on this channelvoid
setUnlimited(boolean unlimited)
private void
shutdown(ShutdownSignalException signal)
-
-
-
Field Detail
-
workService
private final ConsumerWorkService workService
-
connection
private final AMQConnection connection
-
channel
private final Channel channel
-
shuttingDown
private volatile boolean shuttingDown
-
shutdownConsumersDriven
private volatile boolean shutdownConsumersDriven
-
shutdownConsumersComplete
private volatile java.util.concurrent.CountDownLatch shutdownConsumersComplete
-
shutdownSignal
private volatile ShutdownSignalException shutdownSignal
-
-
Constructor Detail
-
ConsumerDispatcher
public ConsumerDispatcher(AMQConnection connection, Channel channel, ConsumerWorkService workService)
-
-
Method Detail
-
quiesce
public void quiesce()
Prepare for shutdown of all consumers on this channel
-
setUnlimited
public void setUnlimited(boolean unlimited)
-
handleConsumeOk
public void handleConsumeOk(Consumer delegate, java.lang.String consumerTag)
-
handleCancelOk
public void handleCancelOk(Consumer delegate, java.lang.String consumerTag)
-
handleCancel
public void handleCancel(Consumer delegate, java.lang.String consumerTag)
-
handleRecoverOk
public void handleRecoverOk(Consumer delegate, java.lang.String consumerTag)
-
handleDelivery
public void handleDelivery(Consumer delegate, java.lang.String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws java.io.IOException
- Throws:
java.io.IOException
-
handleShutdownSignal
public java.util.concurrent.CountDownLatch handleShutdownSignal(java.util.Map<java.lang.String,Consumer> consumers, ShutdownSignalException signal)
-
notifyConsumersOfShutdown
private void notifyConsumersOfShutdown(java.util.Map<java.lang.String,Consumer> consumers, ShutdownSignalException signal)
-
notifyConsumerOfShutdown
private void notifyConsumerOfShutdown(java.lang.String consumerTag, Consumer consumer, ShutdownSignalException signal)
-
executeUnlessShuttingDown
private void executeUnlessShuttingDown(java.lang.Runnable r)
-
execute
private void execute(java.lang.Runnable r)
-
shutdown
private void shutdown(ShutdownSignalException signal)
-
checkShutdown
private void checkShutdown()
-
-