Package ome.services.blitz.impl
Class SharedResourcesI
- java.lang.Object
-
- ome.services.blitz.impl.AbstractAmdServant
-
- ome.services.blitz.impl.AbstractCloseableAmdServant
-
- ome.services.blitz.impl.SharedResourcesI
-
- All Implemented Interfaces:
BlitzOnly
,ServiceFactoryAware
,_SharedResourcesOperations
,ParamsHelper.Acquirer
,CloseableServant
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class SharedResourcesI extends AbstractCloseableAmdServant implements _SharedResourcesOperations, BlitzOnly, ServiceFactoryAware, ParamsHelper.Acquirer
Implementation of the SharedResources interface.- Since:
- Beta4.1
- See Also:
SharedResources
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_TIMEOUT
If no value is passed to this instance, this is the time (1 hour) which will be used for a script session.
-
Constructor Summary
Constructors Constructor Description SharedResourcesI(BlitzExecutor be, TopicManager topicManager, Registry registry, ome.services.scripts.ScriptRepoHelper helper, ParamsCache cache)
SharedResourcesI(BlitzExecutor be, TopicManager topicManager, Registry registry, ome.services.scripts.ScriptRepoHelper helper, ParamsCache cache, long waitMillis)
SharedResourcesI(BlitzExecutor be, TopicManager topicManager, Registry registry, ome.services.scripts.ScriptRepoHelper helper, ParamsCache cache, long waitMillis, long timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InteractiveProcessorPrx
acquireProcessor(Job submittedJob, int seconds, Ice.Current current)
Waits up to seconds to acquire a slot in a processor which can handle the given job.void
addProcessor(ProcessorPrx proc, Ice.Current __current)
Registers aProcessor
for Storm notifications so that other sessions can query whether or not a given processor would accept a given task.boolean
areTablesEnabled(Ice.Current __current)
Returns true if aTables
service is active in the grid.RepositoryPrx
getScriptRepository(Ice.Current __current)
Returns the single (possibly mirrored) script repository which makes all official scripts available.TablePrx
newTable(long repo, java.lang.String path, Ice.Current __current)
Creates a new Format(""OMERO.tables"") file at the given path on the given repository.TablePrx
openTable(OriginalFile file, Ice.Current __current)
Returns a Table instance or null.protected void
postClose(Ice.Current current)
Should not throw any exceptions which should be detected by clients since it is called in a finally block after the client thread has been released.protected void
preClose(Ice.Current current)
void
removeProcessor(ProcessorPrx proc, Ice.Current __current)
Unregisters aProcessor
from Storm notifications.RepositoryMap
repositories(Ice.Current current)
Returns a map between Repository descriptions (omero::model::OriginalFile instances) and RepositoryPrx instances (possibly null).void
setServiceFactory(ServiceFactoryI sf)
-
Methods inherited from class ome.services.blitz.impl.AbstractCloseableAmdServant
close, close_async
-
Methods inherited from class ome.services.blitz.impl.AbstractAmdServant
activate_async, applyHardWiredInterceptors, callInvokerOnMappedArgs, callInvokerOnRawArgs, executorWorkCall, getCurrentEventContext_async, onSetOmeroContext, passivate_async, runnableCall, safeRunnableCall, setApplicationContext, setHolder
-
-
-
-
Field Detail
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUT
If no value is passed to this instance, this is the time (1 hour) which will be used for a script session.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SharedResourcesI
public SharedResourcesI(BlitzExecutor be, TopicManager topicManager, Registry registry, ome.services.scripts.ScriptRepoHelper helper, ParamsCache cache)
-
SharedResourcesI
public SharedResourcesI(BlitzExecutor be, TopicManager topicManager, Registry registry, ome.services.scripts.ScriptRepoHelper helper, ParamsCache cache, long waitMillis)
-
SharedResourcesI
public SharedResourcesI(BlitzExecutor be, TopicManager topicManager, Registry registry, ome.services.scripts.ScriptRepoHelper helper, ParamsCache cache, long waitMillis, long timeout)
-
-
Method Detail
-
setServiceFactory
public void setServiceFactory(ServiceFactoryI sf) throws ServerError
- Specified by:
setServiceFactory
in interfaceServiceFactoryAware
- Throws:
ServerError
-
preClose
protected void preClose(Ice.Current current)
- Specified by:
preClose
in classAbstractCloseableAmdServant
-
postClose
protected void postClose(Ice.Current current)
Description copied from class:AbstractCloseableAmdServant
Should not throw any exceptions which should be detected by clients since it is called in a finally block after the client thread has been released.- Specified by:
postClose
in classAbstractCloseableAmdServant
-
getScriptRepository
public RepositoryPrx getScriptRepository(Ice.Current __current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Returns the single (possibly mirrored) script repository which makes all official scripts available.- Specified by:
getScriptRepository
in interface_SharedResourcesOperations
- Parameters:
__current
- The Current object for the invocation.- Throws:
ServerError
-
repositories
public RepositoryMap repositories(Ice.Current current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Returns a map between Repository descriptions (omero::model::OriginalFile instances) and RepositoryPrx instances (possibly null).- Specified by:
repositories
in interface_SharedResourcesOperations
- Parameters:
current
- The Current object for the invocation.- Throws:
ServerError
-
areTablesEnabled
public boolean areTablesEnabled(Ice.Current __current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Returns true if aTables
service is active in the grid. If this value is false, then all calls to#ewTable
oropenTable
will either fail or return null (possibly blocking while waiting for a service to startup)- Specified by:
areTablesEnabled
in interface_SharedResourcesOperations
- Parameters:
__current
- The Current object for the invocation.- Throws:
ServerError
-
newTable
public TablePrx newTable(long repo, java.lang.String path, Ice.Current __current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Creates a new Format(""OMERO.tables"") file at the given path on the given repository. The returned Table proxy follows the same semantics as the openTable method.- Specified by:
newTable
in interface_SharedResourcesOperations
__current
- The Current object for the invocation.- Throws:
ServerError
-
openTable
public TablePrx openTable(OriginalFile file, Ice.Current __current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Returns a Table instance or null. Table instances are not exclusively owned by the client and may throw an OptimisticLockException if background modifications take place. The file instance must be managed (i.e. have a non-null id) and be of the format ""OMERO.tables"". Use newTable() to create a new instance.- Specified by:
openTable
in interface_SharedResourcesOperations
__current
- The Current object for the invocation.- Throws:
ServerError
-
acquireProcessor
public InteractiveProcessorPrx acquireProcessor(Job submittedJob, int seconds, Ice.Current current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Waits up to seconds to acquire a slot in a processor which can handle the given job.- Specified by:
acquireProcessor
in interface_SharedResourcesOperations
- Specified by:
acquireProcessor
in interfaceParamsHelper.Acquirer
current
- The Current object for the invocation.- Throws:
ServerError
-
addProcessor
public void addProcessor(ProcessorPrx proc, Ice.Current __current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Registers aProcessor
for Storm notifications so that other sessions can query whether or not a given processor would accept a given task.- Specified by:
addProcessor
in interface_SharedResourcesOperations
__current
- The Current object for the invocation.- Throws:
ServerError
-
removeProcessor
public void removeProcessor(ProcessorPrx proc, Ice.Current __current) throws ServerError
Description copied from interface:_SharedResourcesOperations
Unregisters aProcessor
from Storm notifications. If the processor was not already registered viaaddProcessor
this is a no-op.- Specified by:
removeProcessor
in interface_SharedResourcesOperations
__current
- The Current object for the invocation.- Throws:
ServerError
-
-