public class ParamsCache
extends java.lang.Object
implements org.springframework.context.ApplicationContextAware
ParamsHelper
which maintains an
OriginalFile
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 on
getParams(Long, String, Current)
then an attempt will be made to
load it. Any exceptions thrown will be propagated to the caller.Constructor and Description |
---|
ParamsCache(Registry reg,
ome.system.Roles roles,
ome.services.scripts.ScriptRepoHelper scripts,
java.lang.String spec) |
Modifier and Type | Method and Description |
---|---|
JobParams |
getParams(java.lang.Long id,
java.lang.String sha1,
Ice.Current curr)
Lookup a cached
JobParams instance for the given key. |
JobParams |
lookup(ome.services.blitz.util.ParamsCache.Key key)
Called by the
LoadingCache 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 cached
JobParams instance. |
void |
setApplicationContext(org.springframework.context.ApplicationContext ctx) |
public ParamsCache(Registry reg, ome.system.Roles roles, ome.services.scripts.ScriptRepoHelper scripts, java.lang.String spec)
public void setApplicationContext(org.springframework.context.ApplicationContext ctx) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public JobParams getParams(java.lang.Long id, java.lang.String sha1, Ice.Current curr) throws Ice.UserException
JobParams
instance for the given key. If none
is present, then an attempt will be made to load one, possibly throwing
a UserException
.id
- sha1
- curr
- Ice.UserException
public void removeParams(java.lang.Long id)
JobParams
instance.id
- The id of the job.public JobParams lookup(ome.services.blitz.util.ParamsCache.Key key) throws java.lang.Exception
LoadingCache
when a cache-miss occurs.java.lang.Exception
public void lookupAll() throws java.lang.Exception
java.lang.Exception