T - type of items upon which this stage operates@ThreadSafe public class SplitMergeStage<T> extends BaseStage<T>
ExecutorService and operate on
collections that contains clones of the (non-)selected items.
This stage requires the following properties be set prior to initialization:
selectionStrategyselectedItemPipeline or nonselectedItemPipeline
If no executorService is provided, one will be created using Executors.newFixedThreadPool(int) with
6 threads.
If no collectionFactory is given, then SimpleItemCollectionFactory is used.
If one or the other pipeline is null then no objects will be passed to it (obviously).
| Modifier and Type | Field and Description |
|---|---|
private com.google.common.base.Supplier<Collection<Item<T>>> |
collectionFactory
Factory used to create the Item collection that is then given to the pipelines.
|
private ExecutorService |
executorService
Service used to execute the selected and/or non-selected item pipelines.
|
private Logger |
log
Class logger.
|
private CollectionMergeStrategy |
mergeStrategy
Strategy used to merge all the joined pipeline results in to the final Item collection.
|
private Pipeline<T> |
nonselectedItemPipeline
Pipeline that receives the non-selected items.
|
private Pipeline<T> |
selectedItemPipeline
Pipeline that receives the selected items.
|
private com.google.common.base.Predicate<Item<T>> |
selectionStrategy
Strategy used to split the given item collection.
|
| Constructor and Description |
|---|
SplitMergeStage() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doDestroy() |
protected void |
doExecute(Collection<Item<T>> itemCollection)
Performs the stage processing on the given Item collection.
|
protected void |
doInitialize() |
protected Future<Collection<Item<T>>> |
executePipeline(Pipeline<T> pipeline,
Collection<Item<T>> items)
Executes a pipeline.
|
com.google.common.base.Supplier<Collection<Item<T>>> |
getCollectionFactory()
Gets the factory used to create the Item collection that is then given to the pipelines.
|
CollectionMergeStrategy |
getCollectionMergeStrategy()
Gets the strategy used to merge all the joined pipeline results in to the final Item collection.
|
ExecutorService |
getExecutorService()
Gets the executor service used to run the selected and non-selected item pipelines.
|
Pipeline<T> |
getNonselectedItemPipeline()
Gets the pipeline that receives the non-selected items.
|
Pipeline<T> |
getSelectedItemPipeline()
Gets the pipeline that receives the selected items.
|
com.google.common.base.Predicate<Item<T>> |
getSelectionStrategy()
Gets the strategy used to split the given item collection.
|
void |
setCollectionFactory(com.google.common.base.Supplier<Collection<Item<T>>> factory)
Sets the factory used to create the Item collection that is then given to the pipelines.
|
void |
setCollectionMergeStrategy(CollectionMergeStrategy strategy)
Sets the strategy used to merge all the joined pipeline results in to the final Item collection.
|
void |
setExecutorService(ExecutorService service)
Sets the executor service used to run the selected and non-selected item pipelines.
|
void |
setNonselectedItemPipeline(Pipeline<T> pipeline)
Sets the pipeline that receives the non-selected items.
|
void |
setSelectedItemPipeline(Pipeline<T> pipeline)
Sets the pipeline that receives the selected items.
|
void |
setSelectionStrategy(com.google.common.base.Predicate<Item<T>> strategy)
Sets the strategy used to split the given item collection.
|
execute, getCollectionPredicate, setCollectionPredicatesetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdestroy, isDestroyedprivate final Logger log
private ExecutorService executorService
private com.google.common.base.Supplier<Collection<Item<T>>> collectionFactory
private com.google.common.base.Predicate<Item<T>> selectionStrategy
private Pipeline<T> selectedItemPipeline
private Pipeline<T> nonselectedItemPipeline
private CollectionMergeStrategy mergeStrategy
@Nonnull public ExecutorService getExecutorService()
public void setExecutorService(@Nonnull ExecutorService service)
service - executor service used to run the selected and non-selected item pipelines@Nonnull public com.google.common.base.Supplier<Collection<Item<T>>> getCollectionFactory()
public void setCollectionFactory(@Nonnull com.google.common.base.Supplier<Collection<Item<T>>> factory)
factory - factory used to create the Item collection that is then given to the pipelines@Nonnull public com.google.common.base.Predicate<Item<T>> getSelectionStrategy()
public void setSelectionStrategy(@Nonnull com.google.common.base.Predicate<Item<T>> strategy)
strategy - strategy used to split the given item collection, never null@Nullable public Pipeline<T> getSelectedItemPipeline()
public void setSelectedItemPipeline(@Nullable Pipeline<T> pipeline)
pipeline - pipeline that receives the selected items@Nullable public Pipeline<T> getNonselectedItemPipeline()
public void setNonselectedItemPipeline(@Nullable Pipeline<T> pipeline)
pipeline - pipeline that receives the non-selected items@Nonnull public CollectionMergeStrategy getCollectionMergeStrategy()
public void setCollectionMergeStrategy(@Nonnull CollectionMergeStrategy strategy)
strategy - strategy used to merge all the joined pipeline results in to the final Item collection, never
nullprotected void doExecute(@Nonnull@NonnullElements Collection<Item<T>> itemCollection) throws StageProcessingException
The stage is guaranteed to be have been initialized and not destroyed when this is invoked.
doExecute in class BaseStage<T>itemCollection - collection to be processedStageProcessingException - thrown if there is an unrecoverable problem when processing the stage@Nonnull protected Future<Collection<Item<T>>> executePipeline(Pipeline<T> pipeline, Collection<Item<T>> items)
pipeline - the pipeline, may be nullitems - the collections of itemsprotected void doDestroy()
doDestroy in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponentprotected void doInitialize()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
doInitialize in class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponentnet.shibboleth.utilities.java.support.component.ComponentInitializationExceptionCopyright © 1999–2016. All rights reserved.