Package com.rabbitmq.client.impl
Class ConsumerDispatcher
- java.lang.Object
-
- com.rabbitmq.client.impl.ConsumerDispatcher
-
final class ConsumerDispatcher extends java.lang.ObjectDispatches notifications to aConsumeron an internally-managed executor service and work pool. EachChannelhas 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 Channelchannelprivate AMQConnectionconnectionprivate java.util.concurrent.CountDownLatchshutdownConsumersCompleteprivate booleanshutdownConsumersDrivenprivate ShutdownSignalExceptionshutdownSignalprivate booleanshuttingDownprivate ConsumerWorkServiceworkService
-
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 voidcheckShutdown()private voidexecute(java.lang.Runnable r)private voidexecuteUnlessShuttingDown(java.lang.Runnable r)voidhandleCancel(Consumer delegate, java.lang.String consumerTag)voidhandleCancelOk(Consumer delegate, java.lang.String consumerTag)voidhandleConsumeOk(Consumer delegate, java.lang.String consumerTag)voidhandleDelivery(Consumer delegate, java.lang.String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)voidhandleRecoverOk(Consumer delegate, java.lang.String consumerTag)java.util.concurrent.CountDownLatchhandleShutdownSignal(java.util.Map<java.lang.String,Consumer> consumers, ShutdownSignalException signal)private voidnotifyConsumerOfShutdown(java.lang.String consumerTag, Consumer consumer, ShutdownSignalException signal)private voidnotifyConsumersOfShutdown(java.util.Map<java.lang.String,Consumer> consumers, ShutdownSignalException signal)voidquiesce()Prepare for shutdown of all consumers on this channelvoidsetUnlimited(boolean unlimited)private voidshutdown(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()
-
-