@Override public void close() { try { sortAndReduce(); } catch (Exception e) { throw new ExceptionInChainedStubException(this.taskName, e); } this.outputCollector.close(); }
public static Exception exceptionUnwrap(Exception e) { if (e instanceof ExceptionInChainedStubException) { return exceptionUnwrap(((ExceptionInChainedStubException) e).getWrappedException()); } return e; } }
/** * Prints an error message and throws the given exception. If the exception is of the type * {@link ExceptionInChainedStubException} then the chain of contained exceptions is followed * until an exception of a different type is found. * * @param ex The exception to be thrown. * @param parent The parent task, whose information is included in the log message. * @throws Exception Always thrown. */ public static void logAndThrowException(Exception ex, AbstractInvokable parent) throws Exception { String taskName; if (ex instanceof ExceptionInChainedStubException) { do { ExceptionInChainedStubException cex = (ExceptionInChainedStubException) ex; taskName = cex.getTaskName(); ex = cex.getWrappedException(); } while (ex instanceof ExceptionInChainedStubException); } else { taskName = parent.getEnvironment().getTaskInfo().getTaskName(); } if (LOG.isErrorEnabled()) { LOG.error(constructLogString("Error in task code", taskName, parent), ex); } throw ex; }
public ExceptionInChainedStubException(String taskName, Exception wrappedException) { super("Exception in chained task '" + taskName + "'", exceptionUnwrap(wrappedException)); this.taskName = taskName; this.exception = wrappedException; }
/** * Prints an error message and throws the given exception. If the exception is of the type * {@link ExceptionInChainedStubException} then the chain of contained exceptions is followed * until an exception of a different type is found. * * @param ex The exception to be thrown. * @param parent The parent task, whose information is included in the log message. * @throws Exception Always thrown. */ public static void logAndThrowException(Exception ex, AbstractInvokable parent) throws Exception { String taskName; if (ex instanceof ExceptionInChainedStubException) { do { ExceptionInChainedStubException cex = (ExceptionInChainedStubException) ex; taskName = cex.getTaskName(); ex = cex.getWrappedException(); } while (ex instanceof ExceptionInChainedStubException); } else { taskName = parent.getEnvironment().getTaskInfo().getTaskName(); } if (LOG.isErrorEnabled()) { LOG.error(constructLogString("Error in task code", taskName, parent), ex); } throw ex; }
public ExceptionInChainedStubException(String taskName, Exception wrappedException) { super("Exception in chained task '" + taskName + "'", exceptionUnwrap(wrappedException)); this.taskName = taskName; this.exception = wrappedException; }
@Override public void collect(IT record) { try { this.numRecordsIn.inc(); this.mapper.flatMap(record, this.outputCollector); } catch (Exception ex) { throw new ExceptionInChainedStubException(this.taskName, ex); } }
public static Exception exceptionUnwrap(Exception e) { if (e instanceof ExceptionInChainedStubException) { return exceptionUnwrap(((ExceptionInChainedStubException) e).getWrappedException()); } return e; } }
/** * Prints an error message and throws the given exception. If the exception is of the type * {@link ExceptionInChainedStubException} then the chain of contained exceptions is followed * until an exception of a different type is found. * * @param ex The exception to be thrown. * @param parent The parent task, whose information is included in the log message. * @throws Exception Always thrown. */ public static void logAndThrowException(Exception ex, AbstractInvokable parent) throws Exception { String taskName; if (ex instanceof ExceptionInChainedStubException) { do { ExceptionInChainedStubException cex = (ExceptionInChainedStubException) ex; taskName = cex.getTaskName(); ex = cex.getWrappedException(); } while (ex instanceof ExceptionInChainedStubException); } else { taskName = parent.getEnvironment().getTaskInfo().getTaskName(); } if (LOG.isErrorEnabled()) { LOG.error(constructLogString("Error in task code", taskName, parent), ex); } throw ex; }
ex = ExceptionInChainedStubException.exceptionUnwrap(ex);
@Override public void close() { try { sortAndReduce(); } catch (Exception e) { throw new ExceptionInChainedStubException(this.taskName, e); } this.outputCollector.close(); }
public static Exception exceptionUnwrap(Exception e) { if (e instanceof ExceptionInChainedStubException) { return exceptionUnwrap(((ExceptionInChainedStubException) e).getWrappedException()); } return e; } }
/** * Prints an error message and throws the given exception. If the exception is of the type * {@link ExceptionInChainedStubException} then the chain of contained exceptions is followed * until an exception of a different type is found. * * @param ex The exception to be thrown. * @param parent The parent task, whose information is included in the log message. * @throws Exception Always thrown. */ public static void logAndThrowException(Exception ex, AbstractInvokable parent) throws Exception { String taskName; if (ex instanceof ExceptionInChainedStubException) { do { ExceptionInChainedStubException cex = (ExceptionInChainedStubException) ex; taskName = cex.getTaskName(); ex = cex.getWrappedException(); } while (ex instanceof ExceptionInChainedStubException); } else { taskName = parent.getEnvironment().getTaskInfo().getTaskName(); } if (LOG.isErrorEnabled()) { LOG.error(constructLogString("Error in task code", taskName, parent), ex); } throw ex; }
ex = ExceptionInChainedStubException.exceptionUnwrap(ex);
@Override public void close() { try { sortAndReduce(); } catch (Exception e) { throw new ExceptionInChainedStubException(this.taskName, e); } this.outputCollector.close(); }
public static Exception exceptionUnwrap(Exception e) { if (e instanceof ExceptionInChainedStubException) { return exceptionUnwrap(((ExceptionInChainedStubException) e).getWrappedException()); } return e; } }
ex = ExceptionInChainedStubException.exceptionUnwrap(ex);
@Override public void close() { try { sortAndCombine(); } catch (Exception e) { throw new ExceptionInChainedStubException(this.taskName, e); } this.outputCollector.close(); }
ex = ExceptionInChainedStubException.exceptionUnwrap(ex);
@Override public void collect(IT record) { try { this.numRecordsIn.inc(); this.outputCollector.collect(record); } catch (Exception ex) { throw new ExceptionInChainedStubException(this.taskName, ex); } }