Making rebuild class group from site admin page synchronous NIHVIVO-3461
This commit is contained in:
parent
6c9f87b163
commit
7ee7aedc2b
2 changed files with 10 additions and 8 deletions
|
@ -49,6 +49,13 @@ public class BrowseController extends FreemarkerHttpServlet {
|
||||||
String message = null;
|
String message = null;
|
||||||
String templateName = TEMPLATE_DEFAULT;
|
String templateName = TEMPLATE_DEFAULT;
|
||||||
|
|
||||||
|
if ( vreq.getParameter("clearcache") != null ) {
|
||||||
|
//mainly for debugging
|
||||||
|
if( PolicyHelper.isAuthorizedForActions(vreq, new RebuildVClassGroupCache()) ){
|
||||||
|
clearGroupCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<VClassGroup> groups = null;
|
List<VClassGroup> groups = null;
|
||||||
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
|
||||||
if ( vcgc == null ) {
|
if ( vcgc == null ) {
|
||||||
|
@ -68,17 +75,12 @@ public class BrowseController extends FreemarkerHttpServlet {
|
||||||
templateName = Template.TITLED_MESSAGE.toString();
|
templateName = Template.TITLED_MESSAGE.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( vreq.getParameter("clearcache") != null ) {
|
|
||||||
//mainly for debugging
|
|
||||||
if( PolicyHelper.isAuthorizedForActions(vreq, new RebuildVClassGroupCache()) ){
|
|
||||||
clearGroupCache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TemplateResponseValues(templateName, body);
|
return new TemplateResponseValues(templateName, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void clearGroupCache(){
|
protected void clearGroupCache(){
|
||||||
VClassGroupCache.getVClassGroupCache(getServletContext()).requestCacheUpdate();
|
VClassGroupCache.getVClassGroupCache(getServletContext()).doSynchronousRebuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -178,7 +178,7 @@ public class VClassGroupCache implements IndexingEventListener {
|
||||||
return wdf.getVClassGroupDao();
|
return wdf.getVClassGroupDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doSynchronousRebuild(){
|
public void doSynchronousRebuild(){
|
||||||
//try to rebuild a couple times since the Solr server may not yet be up.
|
//try to rebuild a couple times since the Solr server may not yet be up.
|
||||||
|
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue