public abstract class AbstractErrorHandlerLayer<ConfigurationType> extends AbstractDispatchLayer<ConfigurationType>
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractErrorHandlerLayer.JobState
Abstract superclass of all state models for pending failure handlers.
|
CLEANUP_DELAY_MS, cleanupTimer, dispatchStack
Modifier | Constructor and Description |
---|---|
protected |
AbstractErrorHandlerLayer() |
Modifier and Type | Method and Description |
---|---|
protected void |
addJobToStateList(DispatchJobEvent jobEvent) |
void |
finishedWith(String owningProcess)
Clear cached state for the specified process when notified by the
dispatch stack
|
protected void |
forget(String owningProcess,
int[] index)
Remove the specified pending retry job from the cache
|
protected List<AbstractErrorHandlerLayer.JobState> |
getJobsCopy(String owningProcess)
Get a copy of the list of
AbstractErrorHandlerLayer.JobState s for the owning process, or an
empty list if the owning process is unknown or have been
forgotten . |
protected List<AbstractErrorHandlerLayer.JobState> |
getJobsDefault(String owningProcess)
Get the list of
AbstractErrorHandlerLayer.JobState s for the owning process, creating and
adding it to the state map if necessary. |
protected abstract AbstractErrorHandlerLayer.JobState |
getStateObject(DispatchJobEvent jobEvent)
Generate an appropriate state object from the specified job event.
|
void |
receiveError(DispatchErrorEvent errorEvent)
If an error occurs we can either handle the error or send it to the layer
above for further processing.
|
void |
receiveJob(DispatchJobEvent jobEvent)
Receive a job from the layer above, store it for later retries and pass
it down to the next layer
|
void |
receiveResult(DispatchResultEvent j)
If we see a result with an index matching one of those in the current
retry state we can safely forget that state object
|
void |
receiveResultCompletion(DispatchCompletionEvent c)
If we see a completion event with an index matching one of those in the
current retry state we can safely forget that state object
|
protected void |
removeJob(String owningProcess,
AbstractErrorHandlerLayer.JobState jobState) |
getAbove, getBelow, getProcessor, receiveJobQueue, setDispatchStack
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
configure, getConfiguration
public void finishedWith(String owningProcess)
finishedWith
in interface DispatchLayer<ConfigurationType>
finishedWith
in class AbstractDispatchLayer<ConfigurationType>
public void receiveError(DispatchErrorEvent errorEvent)
receiveError
in interface DispatchLayer<ConfigurationType>
receiveError
in class AbstractDispatchLayer<ConfigurationType>
public void receiveJob(DispatchJobEvent jobEvent)
receiveJob
in interface DispatchLayer<ConfigurationType>
receiveJob
in class AbstractDispatchLayer<ConfigurationType>
public void receiveResult(DispatchResultEvent j)
receiveResult
in interface DispatchLayer<ConfigurationType>
receiveResult
in class AbstractDispatchLayer<ConfigurationType>
public void receiveResultCompletion(DispatchCompletionEvent c)
receiveResultCompletion
in interface DispatchLayer<ConfigurationType>
receiveResultCompletion
in class AbstractDispatchLayer<ConfigurationType>
protected void forget(String owningProcess, int[] index)
owningProcess
- Owning process identifier as returned by
Event.getOwningProcess()
index
- Index of the job as returned by
Event.getIndex()
protected void addJobToStateList(DispatchJobEvent jobEvent)
protected List<AbstractErrorHandlerLayer.JobState> getJobsCopy(String owningProcess)
AbstractErrorHandlerLayer.JobState
s for the owning process, or an
empty list if the owning process is unknown or have been
forgotten
.
This list can safely be iterated over without synchronizing. If you need
to modify the list, either synchronize over the returned list from
getJobsDefault(String)
or use
removeJob(String, JobState)
.
owningProcess
- Owning process identifier as returned by
Event.getOwningProcess()
AbstractErrorHandlerLayer.JobState
s for the
owning process,protected List<AbstractErrorHandlerLayer.JobState> getJobsDefault(String owningProcess)
AbstractErrorHandlerLayer.JobState
s for the owning process, creating and
adding it to the state map if necessary.
Note that all access to the returned list must be synchronized on the list to avoid threading issues.
If you are going to iterate over the list, use
getJobsCopy(String)
instead.
owningProcess
- Owning process identifier as returned by
Event.getOwningProcess()
AbstractErrorHandlerLayer.JobState
s for the owning processgetJobsCopy(String)
protected abstract AbstractErrorHandlerLayer.JobState getStateObject(DispatchJobEvent jobEvent)
protected void removeJob(String owningProcess, AbstractErrorHandlerLayer.JobState jobState)
Copyright © 2015–2016 The Apache Software Foundation. All rights reserved.