Executor.Descriptive, Executor.Impl, Executor.Priority, Executor.SimpleSqlWork, Executor.SimpleWork, Executor.SqlWork, Executor.StatefulWork, Executor.Work<X>
Modifier and Type | Field and Description |
---|---|
protected List<Advice> |
advices |
protected OmeroContext |
context |
protected SessionFactory |
factory |
protected InternalServiceFactory |
isf |
protected CurrentDetails |
principalHolder |
protected String[] |
proxyNames |
protected ExecutorService |
service |
protected SqlAction |
sqlAction |
protected ExecutorService |
systemService |
Constructor and Description |
---|
Executor.Impl(CurrentDetails principalHolder,
SessionFactory factory,
SqlAction sqlAction,
String[] proxyNames) |
Executor.Impl(CurrentDetails principalHolder,
SessionFactory factory,
SqlAction sqlAction,
String[] proxyNames,
ExecutorService service) |
Modifier and Type | Method and Description |
---|---|
Object |
execute(Map<String,String> callContext,
Principal p,
Executor.Work work)
Executes a
Executor.Work instance wrapped in two layers of AOP. |
Object |
execute(Principal p,
Executor.Work work)
Call
#execute(Map
with a null call context. |
Object |
executeSql(Executor.SqlWork work)
Executes a
SqkWork in transaction. |
<T> T |
get(Future<T> future)
Helper method to perform
Future.get() and properly unwrap the
exceptions. |
OmeroContext |
getContext()
Provides access to the context for Work-API consumers who need to publish
events, etc.
|
ExecutorService |
getService()
Returns the
ExecutorService assigned to this instance. |
Principal |
principal()
Returns a
Principal representing your current session or null,
if none is active. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
<T> Future<T> |
submit(Callable<T> callable)
Call
Executor.submit(Map, Callable) with a null callContext. |
<T> Future<T> |
submit(Executor.Priority prio,
Callable<T> callable)
Simple submission method with a
Executor.Priority . |
<T> Future<T> |
submit(Executor.Priority prio,
Map<String,String> callContext,
Callable<T> callable)
Like
Executor.submit(Map, Callable) but provide info to which priority
queue should be used. |
<T> Future<T> |
submit(Map<String,String> callContext,
Callable<T> callable)
Simple submission method which can be used in conjunction with a call to
Executor.execute(Principal, Work) to overcome the no-multiple-login rule. |
protected OmeroContext context
protected InternalServiceFactory isf
protected final CurrentDetails principalHolder
protected final String[] proxyNames
protected final SessionFactory factory
protected final SqlAction sqlAction
protected final ExecutorService service
protected final ExecutorService systemService
public Executor.Impl(CurrentDetails principalHolder, SessionFactory factory, SqlAction sqlAction, String[] proxyNames)
public Executor.Impl(CurrentDetails principalHolder, SessionFactory factory, SqlAction sqlAction, String[] proxyNames, ExecutorService service)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
org.springframework.context.ApplicationContextAware
Invoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
,
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
and
MessageSourceAware
, if applicable.
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
applicationContext
- the ApplicationContext object to be used by this objectorg.springframework.context.ApplicationContextException
- in case of context initialization errorsorg.springframework.beans.BeansException
- if thrown by application context methodsBeanInitializationException
public OmeroContext getContext()
Executor
getContext
in interface Executor
public Principal principal()
Executor
Principal
representing your current session or null,
if none is active.public Object execute(Principal p, Executor.Work work)
#execute(Map, Principal, Work)
with a null call context.public Object execute(Map<String,String> callContext, Principal p, Executor.Work work)
Executor.Work
instance wrapped in two layers of AOP. The
first is intended to acquire the proper arguments for
Work#doWork(TransactionStatus, Session, ServiceFactory)
for
the OmeroContext
, and the second performs all the standard
service actions for any normal method call.
If the Principal
argument is not null, then additionally, a
login/logout sequence will be performed in a try/finally block.public <T> Future<T> submit(Callable<T> callable)
Executor
Executor.submit(Map, Callable)
with a null callContext.public <T> Future<T> submit(Map<String,String> callContext, Callable<T> callable)
Executor
Executor.execute(Principal, Work)
to overcome the no-multiple-login rule.submit
in interface Executor
callContext
- Possibly null. See CurrentDetails.setContext(Map)
public <T> Future<T> submit(Executor.Priority prio, Callable<T> callable)
Executor
Executor.Priority
.submit
in interface Executor
prio
- Possibly null. See Executor.submit(Priority, Map, Callable)
public <T> Future<T> submit(Executor.Priority prio, Map<String,String> callContext, Callable<T> callable)
Executor
Executor.submit(Map, Callable)
but provide info to which priority
queue should be used.submit
in interface Executor
prio
- Possibly null. Priority for execution. Default: Executor.Priority.USER
callContext
- Possibly null. See CurrentDetails.setContext(Map)
public <T> T get(Future<T> future)
Executor
Future.get()
and properly unwrap the
exceptions. Any RuntimeException
which was thrown during
execution will be rethrown. All other exceptions will be wrapped in an
InternalException
.public ExecutorService getService()
Executor
ExecutorService
assigned to this instance.
Used by Executor.submit(Callable)
and Executor.get(Future)
.getService
in interface Executor
public Object executeSql(Executor.SqlWork work)
SqkWork
in transaction.executeSql
in interface Executor
work
- Non-null.
Version: 5.1.4-ice35-b55
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.