Class CommandExecutorImpl
java.lang.Object
ch.tocco.nice2.persist.core.impl.exec.CommandExecutorImpl
- All Implemented Interfaces:
- CommandExecutor
- 
Constructor SummaryConstructorsConstructorDescriptionCommandExecutorImpl(org.slf4j.Logger log, Context currentContext, ContextManager contextManager, PersistenceService persistenceService, QueryBuilderFactory queryBuilderFactory, ThreadHandlerManager threadHandlerManager, L10N l10N) 
- 
Method SummaryModifier and TypeMethodDescriptioncreateForThreadPool(ExecutorService executorService) Creates a newCommandServiceusing the specified thread pool.Returns the defaultCommandServicefor asynchronously executingpersist tasks.voidperform(Mode<E> mode, PersistTask<A, T> task, A arg) Performs the given task immediately using the thread of the caller.voidvoidsetDefaultThreadCount(int defaultThreadCount) voidsetListeners(List<CommandServiceListener> listeners) voidsetModes(List<ModeWrapper> modes) 
- 
Constructor Details- 
CommandExecutorImplpublic CommandExecutorImpl(org.slf4j.Logger log, Context currentContext, ContextManager contextManager, @Lazy PersistenceService persistenceService, QueryBuilderFactory queryBuilderFactory, ThreadHandlerManager threadHandlerManager, L10N l10N) 
 
- 
- 
Method Details- 
registryDidShutdown@PreDestroy public void registryDidShutdown()
- 
setListeners
- 
setDefaultThreadCount@Value("${persist.tasks.commandservice.maxThreads}") public void setDefaultThreadCount(int defaultThreadCount) 
- 
initializeService@PostConstruct public void initializeService()
- 
setModes
- 
performpublic <A,T, Optional<T> performE extends Exception> (Mode<E> mode, PersistTask<A, T> task, @Nullable A arg) throws EDescription copied from interface:CommandExecutorPerforms the given task immediately using the thread of the caller. The supplied mode controls the execution of the task.- Specified by:
- performin interface- CommandExecutor
- Type Parameters:
- T- type of the result of the task
- E- the expected exception
- Parameters:
- mode- the mode controls the execution
- task- the task to execute
- Throws:
- E
 
- 
createForThreadPoolDescription copied from interface:CommandExecutorCreates a newCommandServiceusing the specified thread pool. The returned service is thread safe and can be used as a singleton like any other service.- Specified by:
- createForThreadPoolin interface- CommandExecutor
 
- 
getCommandServiceDescription copied from interface:CommandExecutorReturns the defaultCommandServicefor asynchronously executingpersist tasks. Note, the configuration of the thread pool of the service is left to the implementation. It can be assumed that there are more than one thread executing the persist tasks. Thus, if ordering is important, you would need to create a single-threaded command service usingCommandExecutor.createForThreadPool(ExecutorService).- Specified by:
- getCommandServicein interface- CommandExecutor
 
 
-