public class Execution extends Object
process(com.yahoo.processing.Request)
to move the execution to the next one.Modifier and Type | Class and Description |
---|---|
static class |
Execution.Environment<COMPONENT extends Processor>
Holds the static execution environment for the duration of an execution
|
static class |
Execution.Trace
Tre trace of this execution.
|
Modifier and Type | Field and Description |
---|---|
private com.yahoo.component.chain.Chain<? extends Processor> |
chain |
private Execution.Environment<? extends Processor> |
environment |
private int |
processorIndex
The index of the searcher in the chain which should be executed on the next call
An Execution instance contains the state of a chain execution by
providing a class stack for a chain - when a processor is called
(through this), it will increment the index of the processor to call next,
each time a processor returns (regardless of how) it will do the opposite.
|
private Execution.Trace |
trace |
Modifier | Constructor and Description |
---|---|
|
Execution(com.yahoo.component.chain.Chain<? extends Processor> chain,
Execution execution)
Creates an execution of a chain
|
protected |
Execution(com.yahoo.component.chain.Chain<? extends Processor> chain,
int startIndex,
Execution.Trace trace,
Execution.Environment<? extends Processor> environment)
Creates a new execution by setting the internal state directly.
|
|
Execution(Execution startPoint)
Creates an execution from another.
|
|
Execution(Processor processor,
Execution execution)
Creates an execution of a single processor
|
Modifier and Type | Method and Description |
---|---|
com.yahoo.component.chain.Chain<? extends Processor> |
chain()
Returns the chain this executes
|
static Execution |
createRoot(com.yahoo.component.chain.Chain<? extends Processor> chain,
int traceLevel,
Execution.Environment<? extends Processor> environment)
Creates an execution which is not in the context of an existing execution
|
static Execution |
createRoot(Processor processor,
int traceLevel,
Execution.Environment<? extends Processor> environment)
Creates an execution of a single processor which is not in the context of an existing execution
|
protected Response |
defaultResponse(Request request)
Creates the default response to return from this kind of execution when there are no further processors.
|
Execution.Environment<? extends Processor> |
environment() |
protected Processor |
next()
Returns the next searcher to be invoked in this chain, or null if we are at the last
|
protected int |
nextIndex()
Returns the index into the chain of processors which is currently next
|
protected void |
nextProcessor()
Move this execution to the next processor
|
protected void |
onInvoking(Request request,
Processor next)
A hook called when a processor is to be invoked.
|
protected void |
onReturning(Request request,
Processor processor,
Response response)
A hook called when a processor returns, either normally or by throwing.
|
protected void |
previousProcessor()
Move this execution to the previous processor
|
Response |
process(Request request)
Calls process on the next processor in this chain.
|
String |
toString() |
Execution.Trace |
trace() |
private int processorIndex
private final com.yahoo.component.chain.Chain<? extends Processor> chain
private final Execution.Trace trace
private final Execution.Environment<? extends Processor> environment
public Execution(Processor processor, Execution execution)
processor
- the processor to execute in thisexecution
- the parent execution of thispublic Execution(com.yahoo.component.chain.Chain<? extends Processor> chain, Execution execution)
chain
- the chain to execute in this, starting from the first processorexecution
- the parent execution of thispublic Execution(Execution startPoint)
protected Execution(com.yahoo.component.chain.Chain<? extends Processor> chain, int startIndex, Execution.Trace trace, Execution.Environment<? extends Processor> environment)
chain
- the chain to executestartIndex
- the start index into that chaintrace
- the context of this. If this is created from an existing execution/context,
be sure to do new Context<COMPONENT>(startPoint.context)
first!environment
- the static execution environment to usepublic static Execution createRoot(Processor processor, int traceLevel, Execution.Environment<? extends Processor> environment)
public static Execution createRoot(com.yahoo.component.chain.Chain<? extends Processor> chain, int traceLevel, Execution.Environment<? extends Processor> environment)
chain
- the chain to executetraceLevel
- the level to emit trace atenvironment
- the execution environment to usepublic Response process(Request request)
protected int nextIndex()
protected void onInvoking(Request request, Processor next)
protected void onReturning(Request request, Processor processor, Response response)
request
- the processing requestprocessor
- the processor which returnedresponse
- the response returned, or null if the processor returned by throwingprotected void previousProcessor()
protected void nextProcessor()
protected Processor next()
public com.yahoo.component.chain.Chain<? extends Processor> chain()
protected Response defaultResponse(Request request)
public Execution.Trace trace()
public Execution.Environment<? extends Processor> environment()
Copyright © 2018. All rights reserved.