Class Cascade.AbstractStage
- All Implemented Interfaces:
Cascade.Stage
- Enclosing interface:
- Cascade
Stage.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classDefault Actor Implementation.Nested classes/interfaces inherited from interface com.mackenziehigh.cascade.Cascade.Stage
Cascade.Stage.Actor<I,O> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclose()Asynchronously shutdown this stage, as soon as reasonably possible.final <I,O> Cascade.Stage.Actor.Builder<I, O> newActor()Create a builder that can be used to add a new actor to this stage.protected abstract voidonClose()This method will be invoked when this stage closes.protected abstract voidonRunnable(Cascade.AbstractStage.DefaultActor<?, ?> actor) This method will be invoked whenever an actor needs executed.
-
Constructor Details
-
AbstractStage
public AbstractStage()
-
-
Method Details
-
onRunnable
This method will be invoked whenever an actor needs executed.This method will not be re-invoked, until the actor finishes being executed, even if the actor determines that it needs to be executed again. Rather, the actor will invoke this method again, if needed, at the end of its execution. This strategy helps ensure that no two threads will ever power the actor concurrently. Moreover, this strategy lessons the amount of memory used by some implementations in order to schedule actors.
Implementations of this method should never throw exceptions. If an exception or error is thrown, then the stage will be closed.
- Parameters:
actor- needs to berun()at some point in the future.
-
onClose
protected abstract void onClose()This method will be invoked when this stage closes. -
newActor
Create a builder that can be used to add a new actor to this stage.This method returns a builder, rather than an actor itself, so that further configuration of the actor can be performed, if the calling code so desires.
- Specified by:
newActorin interfaceCascade.Stage- Type Parameters:
I- is the type of messages that the actor will consume.O- is the type of messages that the actor will produce.- Returns:
- the new builder.
-
close
public final void close()Asynchronously shutdown this stage, as soon as reasonably possible.Subsequent invocations of this method are idempotent.
- Specified by:
closein interfaceCascade.Stage
-