Skip to content

Commit

Permalink
HSEARCH-1769 Log worklist on Async work as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanne committed Jan 9, 2015
1 parent febad28 commit 87c0b8f
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -6,10 +6,14 @@
*/
package org.hibernate.search.backend.impl.lucene;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.List;

import org.hibernate.search.backend.IndexingMonitor;
import org.hibernate.search.backend.LuceneWork;
import org.hibernate.search.util.logging.impl.Log;
import org.hibernate.search.util.logging.impl.LoggerFactory;


/**
Expand All @@ -21,6 +25,8 @@
*/
final class AsyncWorkProcessor implements WorkProcessor {

private static final Log log = LoggerFactory.make();

private volatile LuceneBackendResources resources;

public AsyncWorkProcessor(LuceneBackendResources resources) {
Expand All @@ -34,6 +40,17 @@ public void shutdown() {

@Override
public void submit(List<LuceneWork> workList, IndexingMonitor monitor) {
if ( workList.isEmpty() ) {
// only log this error at trace level until we properly fix HSEARCH-1769
if ( log.isTraceEnabled() ) {
StringWriter stackTraceStringWriter = new StringWriter();
PrintWriter stackTracePrintWriter = new PrintWriter( stackTraceStringWriter );
new Throwable().printStackTrace( stackTracePrintWriter );
log.workListShouldNeverBeEmpty( stackTraceStringWriter.toString() );
}
// skip that work
return;
}
LuceneBackendQueueTask luceneBackendQueueProcessor = new LuceneBackendQueueTask(
workList,
resources,
Expand Down

0 comments on commit 87c0b8f

Please sign in to comment.