Package org.mycore.util.concurrent
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 Summary
-
Constructor Summary
ConstructorDescriptionMCRTransactionableCallable
(Callable<V> callable) Creates a newCallable
encapsulating thecall()
method with a newMCRSession
and a database transaction.MCRTransactionableCallable
(Callable<V> callable, MCRSession session) -
Method Summary
-
Field Details
-
session
-
-
Constructor Details
-
MCRTransactionableCallable
Creates a newCallable
encapsulating thecall()
method with a newMCRSession
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
Creates a newCallable
encapsulating thecall()
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 transactionsession
- the session to use
-
-
Method Details
-
call
-
get
Description copied from interface:MCRDecorator
Returns the enclosing instance.- Specified by:
get
in interfaceMCRDecorator<V>
- Returns:
- the decorated instance
-