Making rebuild class group from site admin page synchronous NIHVIVO-3461

This commit is contained in:
briancaruso 2011-12-08 22:30:35 +00:00
parent 6c9f87b163
commit 7ee7aedc2b
2 changed files with 10 additions and 8 deletions

View file

@ -49,6 +49,13 @@ public class BrowseController extends FreemarkerHttpServlet {
String message = null;
String templateName = TEMPLATE_DEFAULT;
if ( vreq.getParameter("clearcache") != null ) {
//mainly for debugging
if( PolicyHelper.isAuthorizedForActions(vreq, new RebuildVClassGroupCache()) ){
clearGroupCache();
}
}
List<VClassGroup> groups = null;
VClassGroupCache vcgc = VClassGroupCache.getVClassGroupCache(getServletContext());
if ( vcgc == null ) {
@ -68,17 +75,12 @@ public class BrowseController extends FreemarkerHttpServlet {
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);
}
protected void clearGroupCache(){
VClassGroupCache.getVClassGroupCache(getServletContext()).requestCacheUpdate();
VClassGroupCache.getVClassGroupCache(getServletContext()).doSynchronousRebuild();
}
}

View file

@ -178,7 +178,7 @@ public class VClassGroupCache implements IndexingEventListener {
return wdf.getVClassGroupDao();
}
protected void doSynchronousRebuild(){
public void doSynchronousRebuild(){
//try to rebuild a couple times since the Solr server may not yet be up.
int attempts = 0;