Package org.cyclos.impl
Class InvokerHandlerImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractGlobalServerComponent
-
- org.cyclos.impl.BaseGlobalHandlerImpl
-
- org.cyclos.impl.InvokerHandlerImpl
-
- All Implemented Interfaces:
InvokerHandler
@Component public class InvokerHandlerImpl extends BaseGlobalHandlerImpl implements InvokerHandler
Implementation forInvokerHandler
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractGlobalServerComponent
rawEntityManagerHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description InvokerHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutorServicegetExecutorService()Returns theExecutorServiceused to run transactions in parallelvoidinitialize()<T> TrunAs(SessionData sessionData, Callable<T> callable)Runs the givenCallableusing the givenSessionData, within the caller's transaction<T> TrunAsInCurrentOrNewTransaction(SessionData sessionData, TransactionLevel level, TransactionCallback<T> callback)If there is a transaction in the current thread with a compatible transaction level as the given one, runs the given transaction callback in the current transaction.<T> Future<T>runAsInParallelTransaction(SessionData sessionData, TransactionLevel transactionLevel, TransactionCallback<T> callback)Submits a new transaction to be executed in a new thread, with the givenTransactionLevel, within the context of the givenSessionData<T> TrunAsInTransaction(SessionData sessionData, TransactionLevel transactionLevel, TransactionCallback<T> callback)Runs the givenTransactionCallbackin a transaction in the current thread, with the givenTransactionLevel, within the context of the givenSessionDatavoidshutdown()voidsubmitAsInParallelTransaction(SessionData sessionData, TransactionLevel transactionLevel, Consumer<TransactionStatus> callback)Submits a new transaction to be executed in a new thread, with the givenTransactionLevel, within the context of the givenSessionData-
Methods inherited from class org.cyclos.impl.AbstractGlobalServerComponent
getBaseEntityManagerHandler, getEntityManager
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.InvokerHandler
translateException
-
-
-
-
Method Detail
-
getExecutorService
public ExecutorService getExecutorService()
Description copied from interface:InvokerHandlerReturns theExecutorServiceused to run transactions in parallel- Specified by:
getExecutorServicein interfaceInvokerHandler- See Also:
InvokerHandler.runAsInParallelTransaction(SessionData, TransactionLevel, TransactionCallback)
-
initialize
@PostConstruct public void initialize()
-
runAs
public <T> T runAs(SessionData sessionData, Callable<T> callable)
Description copied from interface:InvokerHandlerRuns the givenCallableusing the givenSessionData, within the caller's transaction- Specified by:
runAsin interfaceInvokerHandler
-
runAsInCurrentOrNewTransaction
public <T> T runAsInCurrentOrNewTransaction(SessionData sessionData, TransactionLevel level, TransactionCallback<T> callback) throws RetryException
Description copied from interface:InvokerHandlerIf there is a transaction in the current thread with a compatible transaction level as the given one, runs the given transaction callback in the current transaction. Otherwise, throws aRetryExceptionto force a new transaction with the given level to be created, so the next time it will be compatible- Specified by:
runAsInCurrentOrNewTransactionin interfaceInvokerHandler- Throws:
RetryException- If the current transaction level is not compatible with the given one
-
runAsInParallelTransaction
public <T> Future<T> runAsInParallelTransaction(SessionData sessionData, TransactionLevel transactionLevel, TransactionCallback<T> callback)
Description copied from interface:InvokerHandlerSubmits a new transaction to be executed in a new thread, with the givenTransactionLevel, within the context of the givenSessionData- Specified by:
runAsInParallelTransactionin interfaceInvokerHandler
-
runAsInTransaction
public <T> T runAsInTransaction(SessionData sessionData, TransactionLevel transactionLevel, TransactionCallback<T> callback)
Description copied from interface:InvokerHandlerRuns the givenTransactionCallbackin a transaction in the current thread, with the givenTransactionLevel, within the context of the givenSessionData- Specified by:
runAsInTransactionin interfaceInvokerHandler
-
shutdown
@PreDestroy public void shutdown()
-
submitAsInParallelTransaction
public void submitAsInParallelTransaction(SessionData sessionData, TransactionLevel transactionLevel, Consumer<TransactionStatus> callback)
Description copied from interface:InvokerHandlerSubmits a new transaction to be executed in a new thread, with the givenTransactionLevel, within the context of the givenSessionData- Specified by:
submitAsInParallelTransactionin interfaceInvokerHandler
-
-