Adding synchronous build of VClassGroupCache at startup. NIHVIVO-2763
This commit is contained in:
parent
68b9c1d9b5
commit
62ed1ab96d
1 changed files with 11 additions and 6 deletions
|
@ -75,9 +75,8 @@ public class VClassGroupCache {
|
||||||
ModelContext.registerListenerForChanges(context, bccl);
|
ModelContext.registerListenerForChanges(context, bccl);
|
||||||
|
|
||||||
_cacheRebuildThread = new RebuildGroupCacheThread(this);
|
_cacheRebuildThread = new RebuildGroupCacheThread(this);
|
||||||
_cacheRebuildThread.setDaemon(true);
|
_cacheRebuildThread.setDaemon(true);
|
||||||
_cacheRebuildThread.start();
|
_cacheRebuildThread.start();
|
||||||
_cacheRebuildThread.informOfQueueChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized VClassGroup getGroup(String vClassGroupURI) {
|
public synchronized VClassGroup getGroup(String vClassGroupURI) {
|
||||||
|
@ -122,6 +121,7 @@ public class VClassGroupCache {
|
||||||
log.debug("requesting update");
|
log.debug("requesting update");
|
||||||
_cacheRebuildThread.informOfQueueChange();
|
_cacheRebuildThread.informOfQueueChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void requestStop() {
|
protected void requestStop() {
|
||||||
if (_cacheRebuildThread != null) {
|
if (_cacheRebuildThread != null) {
|
||||||
_cacheRebuildThread.kill();
|
_cacheRebuildThread.kill();
|
||||||
|
@ -142,6 +142,9 @@ public class VClassGroupCache {
|
||||||
return wdf.getVClassGroupDao();
|
return wdf.getVClassGroupDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void doSynchronousRebuild(){
|
||||||
|
_cacheRebuildThread.rebuildCache(this);
|
||||||
|
}
|
||||||
|
|
||||||
/* **************** static utility methods ***************** */
|
/* **************** static utility methods ***************** */
|
||||||
|
|
||||||
|
@ -332,10 +335,12 @@ public class VClassGroupCache {
|
||||||
/* ******************** ServletContextListener **************** */
|
/* ******************** ServletContextListener **************** */
|
||||||
public static class Setup implements ServletContextListener {
|
public static class Setup implements ServletContextListener {
|
||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent sce) {
|
public void contextInitialized(ServletContextEvent sce) {
|
||||||
ServletContext servletContext = sce.getServletContext();
|
ServletContext servletContext = sce.getServletContext();
|
||||||
servletContext.setAttribute(ATTRIBUTE_NAME, new VClassGroupCache(
|
VClassGroupCache vcgc = new VClassGroupCache(servletContext);
|
||||||
servletContext));
|
servletContext.setAttribute(ATTRIBUTE_NAME,vcgc);
|
||||||
|
vcgc.doSynchronousRebuild();
|
||||||
|
log.info("VClassGroupCache added to context");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue