Package org.gcube.common.health.api
Interface ContextPreparation
public interface ContextPreparation
How an application prepares itself in one of its Contexts (e.g. reads or creates its configuration
there and reaches what it needs) and reports its state there. It is optional: an application
without it is active in every Context. The class is annotated
ContextPreparer.
Both methods work in the Context of the token of the caller, which SmartGears sets before calling
them. An exception thrown by either makes the Context inactive, with a generic reason.
-
Method Details
-
prepare
ContextState prepare()Prepares the application in the Context of the caller. It does nothing when the application is already active there. It may be called at the same time in the same Context (the start-up thread, a request, the check of the health), so it must be safe under concurrent calls.- Returns:
- the state of the application in the Context after the attempt
-
state
ContextState state()Returns the state of the application in the Context of the caller, without preparing it.- Returns:
- the state
-