Package com.zfabrik.work
Interface IWorkResource
public interface IWorkResource
Resource that may be registered with a work unit. In general
the work unit is responsible of managing the state of such resource.
It will inform associated resource about events like begin, rollback, and
commit of the resources commit charge (if applicable).
After a resource has been closed, it will not be used again. This is the
time to release associated internal resources.
Resources of a work unit usually has a very defined life time, like a request cycle.
- begin: first interaction during a unit of work
- possibly: commit cycle
- beforeCompletion: All resources before commit
- commit: All resources commit
- afterCompletion: All resources after commit
- rollback: Invoked if the workunit is rollback only at commit time or actually asked to rollback.
- close: Always called at the end. For all resources. Regardless of failures.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
afterCompletion
(boolean rollback) Commits have completed.default void
beforeCompletion
(boolean rollback) The work unit is in the process of completion.default void
begin()
Start.default void
Start.default void
close()
Close.default void
commit()
Commit workdefault void
rollback()
Rollback work
-
Method Details
-
begin
Start. The resource has been registered with the work unit. Defaults to callingbegin()
-
begin
default void begin()Start. The resource has been registered with the work unit. -
beforeCompletion
default void beforeCompletion(boolean rollback) The work unit is in the process of completion. No commit or rollback has been called yet. -
commit
default void commit()Commit work -
rollback
default void rollback()Rollback work -
afterCompletion
default void afterCompletion(boolean rollback) Commits have completed. Everything has been successful so far. -
close
default void close()Close. Called in any case
-