org.apache.flink.runtime.operators.chaining.ExceptionInChainedStubException Java Examples

The following examples show how to use org.apache.flink.runtime.operators.chaining.ExceptionInChainedStubException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BatchTask.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: BatchTask.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: BatchTask.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: NoOpChainedDriver.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public void collect(IT record) {
	try {
		this.numRecordsIn.inc();
		this.outputCollector.collect(record);
	} catch (Exception ex) {
		throw new ExceptionInChainedStubException(this.taskName, ex);
	}
}
 
Example #5
Source File: NoOpChainedDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void collect(IT record) {
	try {
		this.numRecordsIn.inc();
		this.outputCollector.collect(record);
	} catch (Exception ex) {
		throw new ExceptionInChainedStubException(this.taskName, ex);
	}
}
 
Example #6
Source File: NoOpChainedDriver.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void collect(IT record) {
	try {
		this.numRecordsIn.inc();
		this.outputCollector.collect(record);
	} catch (Exception ex) {
		throw new ExceptionInChainedStubException(this.taskName, ex);
	}
}