Class RequestLifeCycle
java.lang.Object
org.exoplatform.container.component.RequestLifeCycle
The request life cycle object allows a client to demarcate the life cycle of the various components associated with containers. It allows container stacking and guarantees that the life cycle of the components will never be called twice in the same stack.
-
Constructor Summary
ConstructorsConstructorDescriptionRequestLifeCycle(ExoContainer container, List<ComponentRequestLifecycle> components) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidbegin(ComponentRequestLifecycle lifeCycle) Starts the life cycle of the provided life cycle and add it to the life cycle stack.static voidbegin(ExoContainer container) Starts the life cycle of the provided container and add it to the life cycle stack.static voidbegin(ExoContainer container, boolean local) Starts the life cycle of the provided container and add it to the life cycle stack.end()Ends the life cycle of the most recent container started.static booleanisStarted(ComponentRequestLifecycle lifeCycle) Check Component Request Lifecycle statusstatic booleanisStarted(ExoContainer container, boolean local) Check all Components Request Lifecycle statusstatic voidstatic voidrestartTransaction(ExoContainer container)
-
Constructor Details
-
RequestLifeCycle
-
-
Method Details
-
begin
Starts the life cycle of the provided container and add it to the life cycle stack. Only the components of the container that have not been previously enrolled in a life cycle are begun.- Parameters:
container- the container to uselocal- will only trigger life cycle for the container and not its ancestors
-
begin
Starts the life cycle of the provided life cycle and add it to the life cycle stack. If the life cycle has already been triggered before then no operation will be really performed. When the life cycle is called, the argument container will be null.- Parameters:
lifeCycle- the life cycle
-
begin
Starts the life cycle of the provided container and add it to the life cycle stack. Only the components of the container that have not been previously enrolled in a life cycle are begun.- Parameters:
container- the container to use
-
end
Ends the life cycle of the most recent container started. Only the components of the container that have not been previously enrolled in a life cycle are ended.
The result map returned has for keys the components whose the life cycle ended during this method call and the associated value are the potential throwable that were thrown by those components. It is usefull when writing unit test to be aware of the throwable of the various components involved in a request life cycle.
- Returns:
- the result map
- Throws:
IllegalStateException- if no container life cycle is associated with this thread
-
restartTransaction
public static void restartTransaction() -
restartTransaction
-
isStarted
Check Component Request Lifecycle status- Returns:
- true if ComponentRequestLifecycle is started otherwise false
- Throws:
IllegalStateException- if the life cycle is null
-
isStarted
Check all Components Request Lifecycle status- Returns:
- true if all ComponentRequestLifecycle is started otherwise false
- Throws:
IllegalStateException- if the container is null
-