@Override public void onRetryReadException(Exception ex) throws Exception { try { retryReadListener.onRetryReadException(ex); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
@SuppressWarnings("unchecked") @Override public void onWriteError(Exception exception, List<? extends S> items) { try { delegate.onWriteError((List<Object>) items, exception); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
@Override public void onReadError(Exception ex) { try { delegate.onReadError(ex); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
@Override public void beforeChunk(ChunkContext context) { try { delegate.beforeChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@Override public void afterRead(T item) { try { delegate.afterRead(item); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void afterChunk(ChunkContext context) { try { delegate.afterChunk(); } catch (Exception e) { throw new UncheckedTransactionException(e); } }
@SuppressWarnings("unchecked") @Override public void afterWrite(List<? extends S> items) { try { delegate.afterWrite((List<Object>) items); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@SuppressWarnings("unchecked") @Override public void beforeWrite(List<? extends S> items) { try { delegate.beforeWrite((List<Object>) items); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void beforeProcess(T item) { try { delegate.beforeProcess(item); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void onProcessError(T item, Exception e) { try { delegate.onProcessError(item, e); } catch (Exception e1) { throw new BatchRuntimeException(e1); } } }
@Override public void beforeRead() { try { delegate.beforeRead(); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void afterProcess(T item, @Nullable S result) { try { delegate.afterProcess(item, result); } catch (Exception e) { throw new BatchRuntimeException(e); } }
@Override public void onRetryProcessException(Object item, Exception ex) throws Exception { try { retryProcessListener.onRetryProcessException(item, ex); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
@Override public void onRetryWriteException(List<Object> items, Exception ex) throws Exception { try { retryWriteListener.onRetryWriteException(items, ex); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
@Override public void onSkipInRead(Throwable t) { if(skipReadDelegate != null && t instanceof Exception) { try { skipReadDelegate.onSkipReadItem((Exception) t); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
@Override public void onSkipInProcess(T item, Throwable t) { if(skipProcessDelegate != null && t instanceof Exception) { try { skipProcessDelegate.onSkipProcessItem(item, (Exception) t); } catch (Exception e) { throw new BatchRuntimeException(e); } } } }
@SuppressWarnings("unchecked") @Override public void onSkipInWrite(S item, Throwable t) { if(skipWriteDelegate != null && t instanceof Exception) { try { /* * assuming this SkipListenerAdapter will only be called from JsrFaultTolerantChunkProcessor, * which calls onSkipInWrite() with the whole chunk (List) of items instead of single item */ skipWriteDelegate.onSkipWriteItem((List<Object>) item, (Exception) t); } catch (Exception e) { throw new BatchRuntimeException(e); } } }
@Override public void onRetryReadException(Exception ex) throws Exception { for (Iterator<RetryReadListener> iterator = listeners.reverse(); iterator.hasNext();) { RetryReadListener listener = iterator.next(); listener.onRetryReadException(ex); } } }
@Override public void onRetryProcessException(Object item, Exception ex) throws Exception { for (Iterator<RetryProcessListener> iterator = listeners.reverse(); iterator.hasNext();) { RetryProcessListener listener = iterator.next(); listener.onRetryProcessException(item, ex); } } }
@Override public void onRetryWriteException(List<Object> items, Exception ex) throws Exception { for (Iterator<RetryWriteListener> iterator = listeners.reverse(); iterator.hasNext();) { RetryWriteListener listener = iterator.next(); listener.onRetryWriteException(items, ex); } } }