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.
  1. begin: first interaction during a unit of work
  2. possibly: commit cycle
    1. beforeCompletion: All resources before commit
    2. commit: All resources commit
    3. afterCompletion: All resources after commit
  3. rollback: Invoked if the workunit is rollback only at commit time or actually asked to rollback.
  4. close: Always called at the end. For all resources. Regardless of failures.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    afterCompletion(boolean rollback)
    Commits have completed.
    default void
    beforeCompletion(boolean rollback)
    The work unit is in the process of completion.
    default void
    Start.
    default void
    begin(WorkUnit workUnit)
    Start.
    default void
    Close.
    default void
    Commit work
    default void
    Rollback work
  • Method Details

    • begin

      default void begin(WorkUnit workUnit)
      Start. The resource has been registered with the work unit. Defaults to calling begin()
    • 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