Class MCRTransactionableCallable<V>

java.lang.Object
org.mycore.util.concurrent.MCRTransactionableCallable<V>
All Implemented Interfaces:
Callable<V>, MCRDecorator<Callable<V>>
Direct Known Subclasses:
MCRFixedUserCallable

public class MCRTransactionableCallable<V> extends Object implements Callable<V>, MCRDecorator<Callable<V>>
Encapsulates a Callable with a mycore session and a database transaction.
Author:
Matthias Eichner
  • Field Details

  • Constructor Details

    • MCRTransactionableCallable

      public MCRTransactionableCallable(Callable<V> callable)
      Creates a new Callable encapsulating the call() method with a new MCRSession and a database transaction. Afterwards the transaction will be committed and the session will be released and closed.

      If you want to execute your callable in the context of an already existing session use the MCRTransactionableCallable(Callable, MCRSession) constructor instead.

      Parameters:
      callable - the callable to execute within a session and transaction
    • MCRTransactionableCallable

      public MCRTransactionableCallable(Callable<V> callable, MCRSession session)
      Creates a new Callable encapsulating the call() method with a new a database transaction. The transaction will be created in the context of the given session. Afterwards the transaction will be committed and the session will be released (but not closed!).
      Parameters:
      callable - the callable to execute within a session and transaction
      session - the session to use
  • Method Details