|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.modules.async.AsyncCoordinator<I>
public class AsyncCoordinator<I>
| Field Summary | |
|---|---|
static Collection |
UNFLUSHABLE_STATE
|
| Constructor Summary | |
|---|---|
AsyncCoordinator()
Creates a new coordinator instance using the default configuration and steal policy. |
|
AsyncCoordinator(AsyncConfig config)
Creates a new coordinator instance with a custom configuration and the default steal policy. |
|
AsyncCoordinator(AsyncConfig config,
StealPolicy<I> stealPolicy)
Creates a new coordinator instance with a custom configuration and steal policy. |
|
| Method Summary | |
|---|---|
void |
add(I item)
Add a new item so that it will be asynchronously processed by the item processor that is provided when the coordinator is started up. |
Collection<ProcessingBucket<I>> |
getLocalBuckets()
Returns the processing buckets that are local to the current node. |
void |
setQuarantinedItemsFilter(QuarantinedItemsFilter<I> filter)
|
void |
start(ItemProcessor<I> processor)
Start the coordinator with an item processor and a concurrency of 1. |
void |
start(ItemProcessor<I> processor,
int processingConcurrency)
Start the coordinator with an item processor and a custom concurrency. |
void |
start(ItemProcessor<I> processor,
int processingConcurrency,
ScatterPolicy policy)
Start the coordinator. |
void |
stop()
Stop the coordinator and all the internal data structures. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Collection UNFLUSHABLE_STATE
| Constructor Detail |
|---|
public AsyncCoordinator()
AsyncCoordinator(AsyncConfig, StealPolicy)public AsyncCoordinator(AsyncConfig config)
config - the custom configuration instance that should be used by this coordinator, if null is used
the default configuration will be usedAsyncCoordinator(AsyncConfig, StealPolicy)
public AsyncCoordinator(AsyncConfig config,
StealPolicy<I> stealPolicy)
null is provided for either argument, the corresponding default will be used. For the
configuration, the default is DefaultAsyncConfig and for the steal policy, the default is
FallBehindStealPolicy. The maxAllowedFallBehind value of the default steal policy will be retrieved
from the configuration.
config - the custom configuration instance that should be used by this coordinator, if null is
provided the default configuration will be usedstealPolicy - the custom steal policy that should be used by this coordinator, if null is provided the
default steal policy will be used| Method Detail |
|---|
public void setQuarantinedItemsFilter(QuarantinedItemsFilter<I> filter)
public void start(ItemProcessor<I> processor)
processor - the item processor instance that will be used to process each item that has been addedstart(ItemProcessor, int, ScatterPolicy)
public void start(ItemProcessor<I> processor,
int processingConcurrency)
processor - the item processor instance that will be used to process each item that has been addedprocessingConcurrency - the number of buckets that will be created to store the work itemsstart(ItemProcessor, int, ScatterPolicy)
public void start(ItemProcessor<I> processor,
int processingConcurrency,
ScatterPolicy policy)
start method has to be
executed by every node. The item processor instance will never be shared and will remain local to the cluster node
that it was instantiated on. This allows each item processor to refer to local resources, like database
connections, without having to worry about how to coordinate these across the cluster. If a lot of work items are
added to the coordinator, there might be a high amount of lock contention while adding the items to the internal
buckets. Increasing the concurrency will create a larger amount of buckets, which allows more work items to be
added concurrently. A custom scatter policy can be provided to change how buckets are internally select when an
item is added. If null is provided for the scatter policy, the default will be used. Meaning that when the
concurrency is 1, the single bucket will always be selected and if the concurrency is higher, the bucket will be
randomly selected at item addition.
processor - the item processor instance that will be used to process each item that has been addedprocessingConcurrency - the number of buckets that will be created to store the work items, this has to be
minimal 1policy - the scatter policy that will be used to select the bucket into which a work item will be addedadd(Object)public void add(I item)
item - the item of work to process asynchronouslystart(ItemProcessor, int, ScatterPolicy)public void stop()
start(ItemProcessor, int, ScatterPolicy)public Collection<ProcessingBucket<I>> getLocalBuckets()
ProcessingBucketListener for the buckets that have been created by the AsyncCoordinator for the
current node.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||