public static class Executor.Impl extends Object implements Executor
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 |
---|
Impl(CurrentDetails principalHolder,
SessionFactory factory,
SqlAction sqlAction,
String[] proxyNames) |
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
Executor.execute(Map, Principal, Work)
with a null call context. |
Object |
executeSql(Executor.SqlWork work)
Executes a
Executor.SqlWork 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(ApplicationContext applicationContext) |
<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 Impl(CurrentDetails principalHolder, SessionFactory factory, SqlAction sqlAction, String[] proxyNames)
public Impl(CurrentDetails principalHolder, SessionFactory factory, SqlAction sqlAction, String[] proxyNames, ExecutorService service)
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
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)
Executor.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
Executor.Work.doWork(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)
callable
- Not null. Action to be taken.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)
callable
- Not null. Action to be taken.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)
callable
- Not null. Action to be taken.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)
Executor.SqlWork
in transaction.executeSql
in interface Executor
work
- Non-null.
Version: 5.2.0-ice35-b12
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.