Java Code Examples for org.apache.flink.util.OptionalFailure#of()

The following examples show how to use org.apache.flink.util.OptionalFailure#of() . 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: ExecutionGraph.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static SerializedValue<OptionalFailure<Object>> serializeAccumulator(String name, OptionalFailure<Accumulator<?, ?>> accumulator) {
	try {
		if (accumulator.isFailure()) {
			return new SerializedValue<>(OptionalFailure.ofFailure(accumulator.getFailureCause()));
		}
		return new SerializedValue<>(OptionalFailure.of(accumulator.getUnchecked().getLocalValue()));
	} catch (IOException ioe) {
		LOG.error("Could not serialize accumulator " + name + '.', ioe);
		try {
			return new SerializedValue<>(OptionalFailure.ofFailure(ioe));
		} catch (IOException e) {
			throw new RuntimeException("It should never happen that we cannot serialize the accumulator serialization exception.", e);
		}
	}
}
 
Example 2
Source File: ExecutionGraph.java    From flink with Apache License 2.0 5 votes vote down vote up
private static SerializedValue<OptionalFailure<Object>> serializeAccumulator(String name, OptionalFailure<Accumulator<?, ?>> accumulator) {
	try {
		if (accumulator.isFailure()) {
			return new SerializedValue<>(OptionalFailure.ofFailure(accumulator.getFailureCause()));
		}
		return new SerializedValue<>(OptionalFailure.of(accumulator.getUnchecked().getLocalValue()));
	} catch (IOException ioe) {
		LOG.error("Could not serialize accumulator " + name + '.', ioe);
		try {
			return new SerializedValue<>(OptionalFailure.ofFailure(ioe));
		} catch (IOException e) {
			throw new RuntimeException("It should never happen that we cannot serialize the accumulator serialization exception.", e);
		}
	}
}
 
Example 3
Source File: ExecutionGraph.java    From flink with Apache License 2.0 5 votes vote down vote up
private static SerializedValue<OptionalFailure<Object>> serializeAccumulator(String name, OptionalFailure<Accumulator<?, ?>> accumulator) {
	try {
		if (accumulator.isFailure()) {
			return new SerializedValue<>(OptionalFailure.ofFailure(accumulator.getFailureCause()));
		}
		return new SerializedValue<>(OptionalFailure.of(accumulator.getUnchecked().getLocalValue()));
	} catch (IOException ioe) {
		LOG.error("Could not serialize accumulator " + name + '.', ioe);
		try {
			return new SerializedValue<>(OptionalFailure.ofFailure(ioe));
		} catch (IOException e) {
			throw new RuntimeException("It should never happen that we cannot serialize the accumulator serialization exception.", e);
		}
	}
}