public class AbortSlowConsumerStrategy extends Object implements SlowConsumerStrategy, Runnable
| Modifier and Type | Field and Description |
|---|---|
protected Broker |
broker |
protected String |
name |
protected org.apache.activemq.thread.Scheduler |
scheduler |
protected Map<Subscription,SlowConsumerEntry> |
slowConsumers |
protected AtomicBoolean |
taskStarted |
| Constructor and Description |
|---|
AbortSlowConsumerStrategy() |
| Modifier and Type | Method and Description |
|---|---|
void |
abortConsumer(Subscription sub,
boolean abortSubscriberConnection) |
protected void |
abortSubscription(Map<Subscription,SlowConsumerEntry> toAbort,
boolean abortSubscriberConnection) |
void |
addDestination(Destination destination)
For Strategies that need to examine assigned destination for slow consumers
periodically the destination is assigned here.
|
long |
getCheckPeriod() |
long |
getMaxSlowCount() |
long |
getMaxSlowDuration() |
String |
getName() |
Map<Subscription,SlowConsumerEntry> |
getSlowConsumers() |
boolean |
isAbortConnection() |
boolean |
isIgnoreNetworkSubscriptions()
Returns whether the strategy is configured to ignore subscriptions that are from a network
connection.
|
void |
run() |
void |
setAbortConnection(boolean abortConnection)
abort the consumers connection rather than sending a stop command to the remote consumer
|
void |
setBrokerService(Broker broker)
Sets the Broker instance which can provide a Scheduler among other things.
|
void |
setCheckPeriod(long checkPeriod)
time in milliseconds between checks for slow subscriptions
|
void |
setIgnoreNetworkConsumers(boolean ignoreNetworkConsumers)
Sets whether the strategy is configured to ignore consumers that are part of a network
connection to another broker.
|
void |
setMaxSlowCount(long maxSlowCount)
number of times a subscription can be deemed slow before triggering abort
effect depends on dispatch rate as slow determination is done on dispatch
|
void |
setMaxSlowDuration(long maxSlowDuration)
time in milliseconds that a sub can remain slow before triggering
an abort.
|
void |
setName(String name) |
void |
slowConsumer(ConnectionContext context,
Subscription subs)
Slow consumer event.
|
protected org.apache.activemq.thread.Scheduler scheduler
protected final AtomicBoolean taskStarted
protected final Map<Subscription,SlowConsumerEntry> slowConsumers
public AbortSlowConsumerStrategy()
public void setBrokerService(Broker broker)
SlowConsumerStrategysetBrokerService in interface SlowConsumerStrategybroker - The running Broker.public void slowConsumer(ConnectionContext context, Subscription subs)
SlowConsumerStrategyslowConsumer in interface SlowConsumerStrategycontext - Connection context of the subscription.subs - The subscription object for the slow consumer.protected void abortSubscription(Map<Subscription,SlowConsumerEntry> toAbort, boolean abortSubscriberConnection)
public void abortConsumer(Subscription sub, boolean abortSubscriberConnection)
public long getMaxSlowCount()
public void setMaxSlowCount(long maxSlowCount)
public long getMaxSlowDuration()
public void setMaxSlowDuration(long maxSlowDuration)
maxSlowDuration - public long getCheckPeriod()
public void setCheckPeriod(long checkPeriod)
checkPeriod - public boolean isAbortConnection()
public void setAbortConnection(boolean abortConnection)
abortConnection - public boolean isIgnoreNetworkSubscriptions()
public void setIgnoreNetworkConsumers(boolean ignoreNetworkConsumers)
ignoreNetworkConsumers - Should this strategy ignore subscriptions made by a network connector.public Map<Subscription,SlowConsumerEntry> getSlowConsumers()
public void addDestination(Destination destination)
SlowConsumerStrategyaddDestination in interface SlowConsumerStrategydestination - A destination to add to a watch list.Copyright © 2005–2020 The Apache Software Foundation. All rights reserved.