Package io.activej.csp.process
Class ChannelSplitter<T>
java.lang.Object
io.activej.csp.process.AbstractCommunicatingProcess
io.activej.csp.process.ChannelSplitter<T>
- All Implemented Interfaces:
io.activej.async.process.AsyncCloseable,io.activej.async.process.AsyncProcess,io.activej.common.initializer.WithInitializer<ChannelSplitter<T>>,HasChannelInput<T>,WithChannelInput<ChannelSplitter<T>,,T> WithChannelOutputs<T>
public final class ChannelSplitter<T>
extends AbstractCommunicatingProcess
implements WithChannelInput<ChannelSplitter<T>,T>, WithChannelOutputs<T>, io.activej.common.initializer.WithInitializer<ChannelSplitter<T>>
-
Field Summary
Fields inherited from interface io.activej.async.process.AsyncCloseable
STATIC -
Method Summary
Modifier and TypeMethodDescriptionprotected voidstatic <T> ChannelSplitter<T>create()static <T> ChannelSplitter<T>create(ChannelSupplier<T> input) protected voidAn operation which is executed in case of manual closing.protected voidDescribes the main operations of the communicating process.getInput()booleanwithSplitFunction(UnaryOperator<T> splitFn) Allows to set a function that will be used for splitting a value.Methods inherited from class io.activej.csp.process.AbstractCommunicatingProcess
afterProcess, close, closeEx, completeProcess, completeProcessEx, doSanitize, getProcessCompletion, isProcessComplete, isProcessStarted, sanitize, sanitize, sanitize, sanitize, startProcessMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.activej.csp.dsl.WithChannelInput
withInputMethods inherited from interface io.activej.common.initializer.WithInitializer
withInitializer
-
Method Details
-
create
-
create
-
withSplitFunction
Allows to set a function that will be used for splitting a value. A split function is applied to incoming value each time it is being sent to an output.- Parameters:
splitFn- split function- Returns:
- this
ChannelSplitter
-
hasOutputs
public boolean hasOutputs() -
getInput
- Specified by:
getInputin interfaceHasChannelInput<T>
-
addOutput
- Specified by:
addOutputin interfaceWithChannelOutputs<T>
-
beforeProcess
protected void beforeProcess()- Overrides:
beforeProcessin classAbstractCommunicatingProcess
-
doProcess
protected void doProcess()Description copied from class:AbstractCommunicatingProcessDescribes the main operations of the communicating process. May include interaction between input (ChannelSupplier) and output (ChannelConsumer).- Specified by:
doProcessin classAbstractCommunicatingProcess
-
doClose
Description copied from class:AbstractCommunicatingProcessAn operation which is executed in case of manual closing.- Specified by:
doClosein classAbstractCommunicatingProcess- Parameters:
e- an exception thrown on closing
-