VIVO-981 An indexing task must never return null status.
This commit is contained in:
parent
2b83e30866
commit
7414084fee
5 changed files with 28 additions and 13 deletions
|
@ -127,6 +127,13 @@ public class IndexController extends FreemarkerHttpServlet {
|
||||||
switch (RequestType.fromRequest(vreq)) {
|
switch (RequestType.fromRequest(vreq)) {
|
||||||
case REBUILD:
|
case REBUILD:
|
||||||
requestRebuild();
|
requestRebuild();
|
||||||
|
try {
|
||||||
|
// Pause, giving a chance to start the task queue.
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// Don't care, so pass it along.
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
return new RedirectResponseValues(PAGE_URL);
|
return new RedirectResponseValues(PAGE_URL);
|
||||||
default:
|
default:
|
||||||
return showDisplay();
|
return showDisplay();
|
||||||
|
|
|
@ -47,6 +47,11 @@ public class IndexingUriFinderListBasic implements IndexingUriFinderList {
|
||||||
Set<String> uris = new HashSet<>();
|
Set<String> uris = new HashSet<>();
|
||||||
for (IndexingUriFinder uriFinder : finders) {
|
for (IndexingUriFinder uriFinder : finders) {
|
||||||
List<String> additions = uriFinder.findAdditionalURIsToIndex(stmt);
|
List<String> additions = uriFinder.findAdditionalURIsToIndex(stmt);
|
||||||
|
if (log.isDebugEnabled() && !additions.isEmpty()) {
|
||||||
|
log.debug(uriFinder + " found " + additions.size()
|
||||||
|
+ " additions " + additions + " for this statement "
|
||||||
|
+ stmt);
|
||||||
|
}
|
||||||
for (String addition : additions) {
|
for (String addition : additions) {
|
||||||
if (addition == null) {
|
if (addition == null) {
|
||||||
log.warn("Finder " + uriFinder + " returned a null URI.");
|
log.warn("Finder " + uriFinder + " returned a null URI.");
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class RebuildIndexTask implements Task {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SearchIndexerStatus getStatus() {
|
public SearchIndexerStatus getStatus() {
|
||||||
return impl == null ? null : impl.getStatus();
|
return impl == null ? SearchIndexerStatus.idle() : impl.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class UpdateStatementsTask implements Task {
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public SearchIndexerStatus getStatus() {
|
public SearchIndexerStatus getStatus() {
|
||||||
return impl == null ? null : impl.getStatus();
|
return impl == null ? SearchIndexerStatus.idle() : impl.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -62,8 +62,11 @@ public class UpdateUrisTask implements Task {
|
||||||
this.uris = new HashSet<>(uris);
|
this.uris = new HashSet<>(uris);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void runNow(Collection<String> uris, SearchIndexExcluderList excluders, DocumentModifierList modifiers, IndividualDao indDao, ListenerList listeners, WorkerThreadPool pool) {
|
static void runNow(Collection<String> uris,
|
||||||
UpdateUrisTaskImpl impl = new UpdateUrisTaskImpl(uris, excluders, modifiers, indDao, listeners, pool);
|
SearchIndexExcluderList excluders, DocumentModifierList modifiers,
|
||||||
|
IndividualDao indDao, ListenerList listeners, WorkerThreadPool pool) {
|
||||||
|
UpdateUrisTaskImpl impl = new UpdateUrisTaskImpl(uris, excluders,
|
||||||
|
modifiers, indDao, listeners, pool);
|
||||||
impl.run();
|
impl.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,11 +78,7 @@ public class UpdateUrisTask implements Task {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SearchIndexerStatus getStatus() {
|
public SearchIndexerStatus getStatus() {
|
||||||
if (impl != null) {
|
return (impl == null) ? SearchIndexerStatus.idle() : impl.getStatus();
|
||||||
return impl.getStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new SearchIndexerStatus(PROCESSING_URIS, since, new UriCounts(0, 0, 0, uris.size(), uris.size()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -113,7 +112,11 @@ public class UpdateUrisTask implements Task {
|
||||||
this.searchEngine = ApplicationUtils.instance().getSearchEngine();
|
this.searchEngine = ApplicationUtils.instance().getSearchEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public UpdateUrisTaskImpl(Collection<String> uris, SearchIndexExcluderList excluders, DocumentModifierList modifiers, IndividualDao indDao, ListenerList listeners, WorkerThreadPool pool) {
|
public UpdateUrisTaskImpl(Collection<String> uris,
|
||||||
|
SearchIndexExcluderList excluders,
|
||||||
|
DocumentModifierList modifiers, IndividualDao indDao,
|
||||||
|
ListenerList listeners, WorkerThreadPool pool) {
|
||||||
|
log.debug("Updating " + uris.size() + " uris.");
|
||||||
this.uris = uris;
|
this.uris = uris;
|
||||||
this.excluders = excluders;
|
this.excluders = excluders;
|
||||||
this.modifiers = modifiers;
|
this.modifiers = modifiers;
|
||||||
|
|
Loading…
Add table
Reference in a new issue