Package org.rapidcontext.core.proc
Class ReserveInterceptor
java.lang.Object
org.rapidcontext.core.storage.StorableObject
org.rapidcontext.core.type.Interceptor
org.rapidcontext.core.proc.ReserveInterceptor
- Direct Known Subclasses:
JsCompileInterceptor
A procedure reserve interceptor. Allows overriding, monitoring or
extending resource reservation prior to executing procedure calls.
This is used e.g. to reserve pooled database connections, check
execution permissions or similar.
This class implements a default action if it is the last interceptor in
the chain. Otherwise it forwards the call to the next one. Custom reserve
interceptors can be created by subclassing this class.
-
Field Summary
Fields inherited from class org.rapidcontext.core.type.Interceptor
KEY_DESCRIPTION, KEY_PRIO, PATHFields inherited from class org.rapidcontext.core.storage.StorableObject
dict, KEY_ACTIVATED_TIME, KEY_CLASSNAME, KEY_ID, KEY_TYPE, PREFIX_COMPUTED, PREFIX_HIDDEN -
Constructor Summary
ConstructorsConstructorDescriptionReserveInterceptor(String id, String type, Dict dict) Creates a new reserve interceptor from a serialized representation. -
Method Summary
Modifier and TypeMethodDescriptionstatic ReserveInterceptorget()Returns the top-level reserve interceptor.voidreleaseAll(CallContext cx, boolean commit) Releases all reserved adapter connections.voidreserve(CallContext cx, Procedure proc) Reserves all resources needed for executing a procedure.Methods inherited from class org.rapidcontext.core.type.Interceptor
chain, description, get, init, next, next, prio, setNext
-
Constructor Details
-
ReserveInterceptor
Creates a new reserve interceptor from a serialized representation.- Parameters:
id- the object identifiertype- the object type namedict- the serialized representation
-
-
Method Details
-
get
Returns the top-level reserve interceptor.- Returns:
- the call interceptor
-
reserve
Reserves all resources needed for executing a procedure. All resources needed by sub-procedures will also be reserved.- Parameters:
cx- the procedure contextproc- the procedure definition- Throws:
ProcedureException- if some resource couldn't be reserved
-
releaseAll
Releases all reserved adapter connections. The connections will either be committed or rolled back, depending on the commit flag.- Parameters:
cx- the procedure contextcommit- the commit (or rollback) flag
-