org.terracotta.modules.ehcache.async
Class AsyncCoordinatorImpl<E extends Serializable>

java.lang.Object
  extended by org.terracotta.modules.ehcache.async.AsyncCoordinatorImpl<E>
All Implemented Interfaces:
AsyncCoordinator<E>

public class AsyncCoordinatorImpl<E extends Serializable>
extends Object
implements AsyncCoordinator<E>

An AsyncCoordinator allows work to be added and processed asynchronously in a fault-tolerant and high performance fashion.


Nested Class Summary
static interface AsyncCoordinatorImpl.Callback
           
 
Constructor Summary
AsyncCoordinatorImpl(String fullAsyncName, AsyncConfig config, ToolkitInstanceFactory toolkitInstanceFactory, AsyncCoordinatorImpl.Callback stopCallable)
           
 
Method Summary
 void add(E item)
           
 void destroy()
          Destroy all clustered state associated with the given async coordinator.
 long getQueueSize()
           
 void setOperationsFilter(ItemsFilter<E> filter)
          Attach the specified QuarantinedItemsFilter to this coordinator.
 void start(ItemProcessor<E> itemProcessor, int processingConcurrency, ItemScatterPolicy<? super E> policy)
           
 void stop()
          Stops and waits for the current processing to finish.
Calling this multiple times will result in IllegalStateException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncCoordinatorImpl

public AsyncCoordinatorImpl(String fullAsyncName,
                            AsyncConfig config,
                            ToolkitInstanceFactory toolkitInstanceFactory,
                            AsyncCoordinatorImpl.Callback stopCallable)
Method Detail

start

public void start(ItemProcessor<E> itemProcessor,
                  int processingConcurrency,
                  ItemScatterPolicy<? super E> policy)
Specified by:
start in interface AsyncCoordinator<E extends Serializable>

add

public void add(E item)
Specified by:
add in interface AsyncCoordinator<E extends Serializable>
Parameters:
item - null item are ignored.

stop

public void stop()
Description copied from interface: AsyncCoordinator
Stops and waits for the current processing to finish.
Calling this multiple times will result in IllegalStateException

Specified by:
stop in interface AsyncCoordinator<E extends Serializable>

setOperationsFilter

public void setOperationsFilter(ItemsFilter<E> filter)
Attach the specified QuarantinedItemsFilter to this coordinator.

A quarantined items filter allows scheduled work to be filtered (and possibly skipped) before being executed.

Assigning null as the quarantined filter causes any existing filter to be removed.

Specified by:
setOperationsFilter in interface AsyncCoordinator<E extends Serializable>
Parameters:
filter - filter to be applied

getQueueSize

public long getQueueSize()
Specified by:
getQueueSize in interface AsyncCoordinator<E extends Serializable>
Returns:
the current items to be processed

destroy

public void destroy()
Description copied from interface: AsyncCoordinator
Destroy all clustered state associated with the given async coordinator.

Specified by:
destroy in interface AsyncCoordinator<E extends Serializable>


Copyright © 2003-2013 Terracotta, Inc.. All Rights Reserved.