akka.io
Class PipelineStage<Context extends PipelineContext,CmdAbove,CmdBelow,EvtAbove,EvtBelow>

java.lang.Object
  extended by akka.io.PipelineStage<Context,CmdAbove,CmdBelow,EvtAbove,EvtBelow>
Direct Known Subclasses:
BackpressureBuffer, SslTlsSupport, StringByteStringAdapter, SymmetricPipelineStage, TcpReadWriteAdapter, TickGenerator

public abstract class PipelineStage<Context extends PipelineContext,CmdAbove,CmdBelow,EvtAbove,EvtBelow>
extends java.lang.Object

A pipeline stage which can be combined with other stages to build a protocol stack. The main function of this class is to serve as a factory for the actual PipePair generated by the apply(Context) method so that a context object can be passed in.

See Also:
PipelineFactory

Constructor Summary
PipelineStage()
           
 
Method Summary
protected abstract  PipePair<CmdAbove,CmdBelow,EvtAbove,EvtBelow> apply(Context ctx)
          Implement this method to generate this stage’s pair of command and event functions.
static
<Ctx extends PipelineContext,CmdAbove,CmdBelow,EvtAbove,EvtBelow>
PipelineStage<Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow>
combine(PipelineStage<Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow> left, PipelineStage<Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow> right)
          Java API: combine the two stages such that the command pipeline of the left stage is used and the event pipeline of the right, discarding the other two sub-pipelines.
static
<Ctx extends PipelineContext,CmdAbove,CmdBelow,CmdBelowBelow,EvtAbove,EvtBelow,EvtBelowBelow>
PipelineStage<Ctx,CmdAbove,CmdBelowBelow,EvtAbove,EvtBelowBelow>
sequence(PipelineStage<? super Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow> left, PipelineStage<? super Ctx,CmdBelow,CmdBelowBelow,EvtBelow,EvtBelowBelow> right)
          Java API: attach the two given stages such that the command output of the first is fed into the command input of the second, and the event output of the second is fed into the event input of the first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PipelineStage

public PipelineStage()
Method Detail

sequence

public static <Ctx extends PipelineContext,CmdAbove,CmdBelow,CmdBelowBelow,EvtAbove,EvtBelow,EvtBelowBelow> PipelineStage<Ctx,CmdAbove,CmdBelowBelow,EvtAbove,EvtBelowBelow> sequence(PipelineStage<? super Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow> left,
                                                                                                                                                                                      PipelineStage<? super Ctx,CmdBelow,CmdBelowBelow,EvtBelow,EvtBelowBelow> right)
Java API: attach the two given stages such that the command output of the first is fed into the command input of the second, and the event output of the second is fed into the event input of the first. In other words: sequence the stages such that the left one is on top of the right one.

Parameters:
left - the left or upper pipeline stage
right - the right or lower pipeline stage
Returns:
a pipeline stage representing the sequence of the two stages

combine

public static <Ctx extends PipelineContext,CmdAbove,CmdBelow,EvtAbove,EvtBelow> PipelineStage<Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow> combine(PipelineStage<Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow> left,
                                                                                                                                               PipelineStage<Ctx,CmdAbove,CmdBelow,EvtAbove,EvtBelow> right)
Java API: combine the two stages such that the command pipeline of the left stage is used and the event pipeline of the right, discarding the other two sub-pipelines.

Parameters:
left - the command pipeline
right - the event pipeline
Returns:
a pipeline stage using the left command pipeline and the right event pipeline

apply

protected abstract PipePair<CmdAbove,CmdBelow,EvtAbove,EvtBelow> apply(Context ctx)
Implement this method to generate this stage’s pair of command and event functions.

INTERNAL API: do not use this method to instantiate a pipeline!

See Also:
PipelineFactory, AbstractPipePair, AbstractSymmetricPipePair