Skip to content

Commit

Permalink
IndexExceptionHandler...
Browse files Browse the repository at this point in the history
  • Loading branch information
bleujin committed Apr 10, 2014
1 parent c8e23a4 commit 09a580b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Binary file modified publish/isearcher_4.4.jar
Binary file not shown.
17 changes: 9 additions & 8 deletions src/net/ion/nsearcher/index/IndexExceptionHandler.java
Expand Up @@ -3,17 +3,18 @@
public interface IndexExceptionHandler<T> {

public static IndexExceptionHandler<Void> DEFAULT = new IndexExceptionHandler<Void>() {
public Void onException(Throwable ex) {
ex.printStackTrace() ;
return null ;
}
// public Void onException(Throwable ex) {
// ex.printStackTrace() ;
// return null ;
// }

@Override
public Void onException(IndexJob<Void> job, Throwable ex) {
return onException(ex);
public Void onException(IndexJob job, Throwable ex) {
ex.printStackTrace() ;
return null ;
}
};

public T onException(Throwable ex) ;
public T onException(IndexJob<T> job, Throwable ex) ;
// public T onException(Throwable ex) ;
public T onException(IndexJob job, Throwable ex) ;
}
6 changes: 3 additions & 3 deletions src/net/ion/nsearcher/index/Indexer.java
Expand Up @@ -42,9 +42,9 @@ public <T> T index(String name, Analyzer analyzer, IndexJob<T> indexJob) {
try {
return asyncIndex(name, analyzer, indexJob).get() ;
} catch (InterruptedException e) {
ehandler.onException(e) ;
ehandler.onException(indexJob, e) ;
} catch (ExecutionException e) {
ehandler.onException(e) ;
ehandler.onException(indexJob, e) ;
}
return null ;
}
Expand Down Expand Up @@ -92,7 +92,7 @@ public T call() throws Exception {
return result;
} catch(Throwable ex) {
if (session != null) session.rollback();
handler.onException(ex) ;
handler.onException(indexJob, ex) ;
// return null ;
throw new IndexException(ex.getMessage(), ex) ;
} finally {
Expand Down

0 comments on commit 09a580b

Please sign in to comment.