Class LifecycleHelper
- java.lang.Object
-
- com._1c.g5.v8.bm.common.lifecycle.LifecycleHelper
-
public final class LifecycleHelper extends Object
Lifecycle helper is a tool for managing transitions between lifecycle phases.The lifecycle helper supports the following set of phases:
- Initial
- Starting
- Running
- Closing
- Closed
The lifecycle helper is thread-safe.
-
-
Constructor Summary
Constructors Constructor Description LifecycleHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginClose()Performs transition from Running to Closing phase.voidbeginStart()Performs transition from Initial to Starting phase.voidbeginUserOperation()Registers a user operation.voidendClose()Performs transition from Closing to Closed phase.voidendStart(boolean successful)Performs transition from Starting to Running phase in case the start was successful, otherwise performs transition to Closed phase.voidendUserOperation()Deregisters a user operation.
-
-
-
Method Detail
-
beginStart
public void beginStart()
Performs transition from Initial to Starting phase.- In case the current phase is not Initial an exception is thrown.
-
endStart
public void endStart(boolean successful)
Performs transition from Starting to Running phase in case the start was successful, otherwise performs transition to Closed phase.- In case the current phase is not Starting an exception is thrown.
- In case this method is invoked by a thread different from the thread that invoked
beginStartan exception is thrown.
- Parameters:
successful- The flag showing whether the start was successful.
-
beginUserOperation
public void beginUserOperation()
Registers a user operation.- In case the current phase is not Running an exception is thrown.
-
endUserOperation
public void endUserOperation()
Deregisters a user operation.- In case the current phase is not Running an exception is thrown.
- The method does not check if the operation was registered in the same thread or if it was registered
at all, however, in case this method was invoked more times than the
beginUserOperationwas, an exception in thrown.
-
beginClose
public void beginClose()
Performs transition from Running to Closing phase. Waits till all the registered user operations are deregistered.- In case the current phase is not Running an exception is thrown.
-
endClose
public void endClose()
Performs transition from Closing to Closed phase.- In case the current phase is not Closing an exception is thrown.
- In case this method is invoked by a thread different from the thread that invoked
beginClosean exception is thrown.
-
-