Package ome.services.blitz.util
Class ParamsCache
- java.lang.Object
-
- ome.services.blitz.util.ParamsCache
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
public class ParamsCache extends java.lang.Object implements org.springframework.context.ApplicationContextAware
Caching replacement ofParamsHelper
which maintains anOriginalFile
ID+SHA1-to-JobParams
mapping in memory rather than storing ParseJob instances in the database. All scripts are read once on start and them subsequently based on the omero.scripts.cache.cron setting.JobParams
instances may be removed from the cache based on the omero.scripts.cache.spec setting. If a key is not present in the cache ongetParams(Long, String, Current)
then an attempt will be made to load it. Any exceptions thrown will be propagated to the caller.- Since:
- 5.1.2
-
-
Constructor Summary
Constructors Constructor Description ParamsCache(Registry reg, ome.system.Roles roles, ome.services.scripts.ScriptRepoHelper scripts, java.lang.String spec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JobParams
getParams(java.lang.Long id, java.lang.String sha1, Ice.Current curr)
Lookup a cachedJobParams
instance for the given key.JobParams
lookup(ome.services.blitz.util.ParamsCache.Key key)
Called by theLoadingCache
when a cache-miss occurs.void
lookupAll()
Called from a Quartz cron trigger for periodically reloading all scripts.void
removeParams(java.lang.Long id)
Remove a cachedJobParams
instance.void
setApplicationContext(org.springframework.context.ApplicationContext ctx)
-
-
-
Constructor Detail
-
ParamsCache
public ParamsCache(Registry reg, ome.system.Roles roles, ome.services.scripts.ScriptRepoHelper scripts, java.lang.String spec)
-
-
Method Detail
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext ctx) throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
getParams
public JobParams getParams(java.lang.Long id, java.lang.String sha1, Ice.Current curr) throws Ice.UserException
Lookup a cachedJobParams
instance for the given key. If none is present, then an attempt will be made to load one, possibly throwing aUserException
.- Parameters:
id
-sha1
-curr
-- Returns:
- See above.
- Throws:
Ice.UserException
-
removeParams
public void removeParams(java.lang.Long id)
Remove a cachedJobParams
instance.- Parameters:
id
- The id of the job.
-
lookup
public JobParams lookup(ome.services.blitz.util.ParamsCache.Key key) throws java.lang.Exception
Called by theLoadingCache
when a cache-miss occurs.- Throws:
java.lang.Exception
-
lookupAll
public void lookupAll() throws java.lang.Exception
Called from a Quartz cron trigger for periodically reloading all scripts.- Throws:
java.lang.Exception
-
-