public class PhaseErrorLifecycleInterceptor extends Object implements LifecycleInterceptor
LifecycleInterceptor
which tracks the completion of the a phase so that if it fails to complete, the another phase is
only applied on the target objects on which it could be successfully applied.Constructor and Description |
---|
PhaseErrorLifecycleInterceptor(String trackingPhase,
String phaseToPreventOnTrackingPhaseError,
Class lifecycleClass)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPhaseExecution(LifecyclePhase phase,
Object object,
com.google.common.base.Optional<Exception> exceptionThrownOptional)
If the
phase name is trackingPhase then it tracks the given object as successful on the
trackingPhase . |
boolean |
beforePhaseExecution(LifecyclePhase phase,
Object object)
Determines if the phase should be skipped if the phase name is
phaseToPreventOnTrackingPhaseError and the object
supports the phase phaseToPreventOnTrackingPhaseError and the phase trackingPhase phase was not successfully
completed |
void |
onPhaseCompleted(LifecyclePhase phase)
If the
phase name is trackingPhase then it marks the trackingPhase phase as completed and clears all
other tracking state so that memory can be reclaimed. |
public PhaseErrorLifecycleInterceptor(String trackingPhase, String phaseToPreventOnTrackingPhaseError, Class lifecycleClass)
trackingPhase
- the phase to track for execution failures.phaseToPreventOnTrackingPhaseError
- the phase to prevent if the trackingPhase
finished with errors.lifecycleClass
- the trackingPhase
interface.public boolean beforePhaseExecution(LifecyclePhase phase, Object object)
phaseToPreventOnTrackingPhaseError
and the object
supports the phase phaseToPreventOnTrackingPhaseError
and the phase trackingPhase
phase was not successfully
completed
If all three of the above conditions are met, then this method returns false
. Otherwise, it returns true
beforePhaseExecution
in interface LifecycleInterceptor
phase
- the phase being appliedobject
- the target objectphase
should be applied on the object
public void afterPhaseExecution(LifecyclePhase phase, Object object, com.google.common.base.Optional<Exception> exceptionThrownOptional)
phase
name is trackingPhase
then it tracks the given object
as successful on the
trackingPhase
.afterPhaseExecution
in interface LifecycleInterceptor
phase
- the phase that was appliedobject
- the target objectexceptionThrownOptional
- an optional with an exception. If present then there was an error execution the phase,
otherwise the phase execution was successfulpublic void onPhaseCompleted(LifecyclePhase phase)
phase
name is trackingPhase
then it marks the trackingPhase
phase as completed and clears all
other tracking state so that memory can be reclaimed.onPhaseCompleted
in interface LifecycleInterceptor
phase
- the phase that was appliedCopyright © 2003–2018 MuleSoft, Inc.. All rights reserved.