use of org.apache.flink.util.WrappingRuntimeException in project flink by apache.
the class StreamExecutionEnvironment method registerCustomListeners.
private void registerCustomListeners(final ClassLoader classLoader, final List<String> listeners) {
for (String listener : listeners) {
try {
final JobListener jobListener = InstantiationUtil.instantiate(listener, JobListener.class, classLoader);
jobListeners.add(jobListener);
} catch (FlinkException e) {
throw new WrappingRuntimeException("Could not load JobListener : " + listener, e);
}
}
}
use of org.apache.flink.util.WrappingRuntimeException in project flink by apache.
the class GlueSchemaRegistryAvroSerializationSchema method serialize.
/**
* Serializes the incoming element to a byte array containing bytes of AWS Glue Schema registry
* information.
*
* @param object The incoming element to be serialized
* @return The serialized bytes.
*/
@Override
public byte[] serialize(T object) {
checkAvroInitialized();
if (object == null) {
return null;
} else {
try {
ByteArrayOutputStream outputStream = getOutputStream();
outputStream.reset();
Encoder encoder = getEncoder();
getDatumWriter().write(object, encoder);
schemaCoder.writeSchema(getSchema(), outputStream);
encoder.flush();
return outputStream.toByteArray();
} catch (IOException e) {
throw new WrappingRuntimeException("Failed to serialize schema registry.", e);
}
}
}
use of org.apache.flink.util.WrappingRuntimeException in project flink by apache.
the class AvroSerializationSchema method serialize.
@Override
public byte[] serialize(T object) {
checkAvroInitialized();
if (object == null) {
return null;
} else {
try {
datumWriter.write(object, encoder);
encoder.flush();
byte[] bytes = arrayOutputStream.toByteArray();
arrayOutputStream.reset();
return bytes;
} catch (IOException e) {
throw new WrappingRuntimeException("Failed to serialize schema registry.", e);
}
}
}
use of org.apache.flink.util.WrappingRuntimeException in project flink by apache.
the class ExecutionEnvironment method registerCustomListeners.
private void registerCustomListeners(final ClassLoader classLoader, final List<String> listeners) {
for (String listener : listeners) {
try {
final JobListener jobListener = InstantiationUtil.instantiate(listener, JobListener.class, classLoader);
jobListeners.add(jobListener);
} catch (FlinkException e) {
throw new WrappingRuntimeException("Could not load JobListener : " + listener, e);
}
}
}
Aggregations