Java Code Examples for org.apache.flink.util.InstantiationUtil#readObjectFromConfig()

The following examples show how to use org.apache.flink.util.InstantiationUtil#readObjectFromConfig() . 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: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getOutEdgesInOrder(ClassLoader cl) {
	try {
		List<StreamEdge> outEdgesInOrder = InstantiationUtil.readObjectFromConfig(this.config, EDGES_IN_ORDER, cl);
		return outEdgesInOrder == null ? new ArrayList<StreamEdge>() : outEdgesInOrder;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate outputs in order.", e);
	}
}
 
Example 2
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public <T> TypeSerializer<T> getTypeSerializerIn2(ClassLoader cl) {
	try {
		return InstantiationUtil.readObjectFromConfig(this.config, TYPE_SERIALIZER_IN_2, cl);
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate serializer.", e);
	}
}
 
Example 3
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public <T> TypeSerializer<T> getTypeSerializerIn1(ClassLoader cl) {
	try {
		return InstantiationUtil.readObjectFromConfig(this.config, TYPE_SERIALIZER_IN_1, cl);
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate serializer.", e);
	}
}
 
Example 4
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public Partitioner<?> getOutputPartitioner(int outputNum, final ClassLoader cl) throws ClassNotFoundException {
	try {
		return (Partitioner<?>) InstantiationUtil.readObjectFromConfig(config, OUTPUT_PARTITIONER + outputNum, cl);
	}
	catch (ClassNotFoundException e) {
		throw e;
	}
	catch (Throwable t) {
		throw new RuntimeException("Could not deserialize custom partitioner.", t);
	}
}
 
Example 5
Source File: TaskConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) {
	try {
		return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config, STUB_OBJECT, cl);
	} catch (ClassNotFoundException | IOException e) {
		throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e);
	}
}
 
Example 6
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public <T> List<OutputSelector<T>> getOutputSelectors(ClassLoader userCodeClassloader) {
	try {
		List<OutputSelector<T>> selectors =
				InstantiationUtil.readObjectFromConfig(this.config, OUTPUT_SELECTOR_WRAPPER, userCodeClassloader);
		return selectors == null ? Collections.<OutputSelector<T>>emptyList() : selectors;

	} catch (Exception e) {
		throw new StreamTaskException("Could not read output selectors", e);
	}
}
 
Example 7
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getNonChainedOutputs(ClassLoader cl) {
	try {
		List<StreamEdge> nonChainedOutputs = InstantiationUtil.readObjectFromConfig(this.config, NONCHAINED_OUTPUTS, cl);
		return nonChainedOutputs == null ?  new ArrayList<StreamEdge>() : nonChainedOutputs;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate non chained outputs.", e);
	}
}
 
Example 8
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getInPhysicalEdges(ClassLoader cl) {
	try {
		List<StreamEdge> inEdges = InstantiationUtil.readObjectFromConfig(this.config, IN_STREAM_EDGES, cl);
		return inEdges == null ? new ArrayList<StreamEdge>() : inEdges;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate inputs.", e);
	}
}
 
Example 9
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public Map<Integer, StreamConfig> getTransitiveChainedTaskConfigs(ClassLoader cl) {
	try {
		Map<Integer, StreamConfig> confs = InstantiationUtil.readObjectFromConfig(this.config, CHAINED_TASK_CONFIG, cl);
		return confs == null ? new HashMap<Integer, StreamConfig>() : confs;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate configuration.", e);
	}
}
 
Example 10
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getOutEdgesInOrder(ClassLoader cl) {
	try {
		List<StreamEdge> outEdgesInOrder = InstantiationUtil.readObjectFromConfig(this.config, EDGES_IN_ORDER, cl);
		return outEdgesInOrder == null ? new ArrayList<StreamEdge>() : outEdgesInOrder;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate outputs in order.", e);
	}
}
 
Example 11
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T> UserCodeWrapper<T> getStubWrapper(ClassLoader cl) {
	try {
		return (UserCodeWrapper<T>) InstantiationUtil.readObjectFromConfig(this.config, STUB_OBJECT, cl);
	} catch (ClassNotFoundException | IOException e) {
		throw new CorruptConfigurationException("Could not read the user code wrapper: " + e.getMessage(), e);
	}
}
 
Example 12
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getOutEdges(ClassLoader cl) {
	try {
		List<StreamEdge> outEdges = InstantiationUtil.readObjectFromConfig(this.config, OUT_STREAM_EDGES, cl);
		return outEdges == null ? new ArrayList<StreamEdge>() : outEdges;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate outputs.", e);
	}
}
 
Example 13
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public KeySelector<?, Serializable> getStatePartitioner(int input, ClassLoader cl) {
	try {
		return InstantiationUtil.readObjectFromConfig(this.config, STATE_PARTITIONER + input, cl);
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate state partitioner.", e);
	}
}
 
Example 14
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public <T> TypeSerializer<T> getTypeSerializerOut(ClassLoader cl) {
	try {
		return InstantiationUtil.readObjectFromConfig(this.config, TYPE_SERIALIZER_OUT_1, cl);
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate serializer.", e);
	}
}
 
Example 15
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getNonChainedOutputs(ClassLoader cl) {
	try {
		List<StreamEdge> nonChainedOutputs = InstantiationUtil.readObjectFromConfig(this.config, NONCHAINED_OUTPUTS, cl);
		return nonChainedOutputs == null ?  new ArrayList<StreamEdge>() : nonChainedOutputs;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate non chained outputs.", e);
	}
}
 
Example 16
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getChainedOutputs(ClassLoader cl) {
	try {
		List<StreamEdge> chainedOutputs = InstantiationUtil.readObjectFromConfig(this.config, CHAINED_OUTPUTS, cl);
		return chainedOutputs == null ? new ArrayList<StreamEdge>() : chainedOutputs;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate chained outputs.", e);
	}
}
 
Example 17
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public <T> TypeSerializer<T> getTypeSerializerOut(ClassLoader cl) {
	try {
		return InstantiationUtil.readObjectFromConfig(this.config, TYPE_SERIALIZER_OUT_1, cl);
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate serializer.", e);
	}
}
 
Example 18
Source File: StreamConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public <T> TypeSerializer<T> getTypeSerializerIn2(ClassLoader cl) {
	try {
		return InstantiationUtil.readObjectFromConfig(this.config, TYPE_SERIALIZER_IN_2, cl);
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate serializer.", e);
	}
}
 
Example 19
Source File: StreamConfig.java    From flink with Apache License 2.0 5 votes vote down vote up
public List<StreamEdge> getOutEdges(ClassLoader cl) {
	try {
		List<StreamEdge> outEdges = InstantiationUtil.readObjectFromConfig(this.config, OUT_STREAM_EDGES, cl);
		return outEdges == null ? new ArrayList<StreamEdge>() : outEdges;
	} catch (Exception e) {
		throw new StreamTaskException("Could not instantiate outputs.", e);
	}
}
 
Example 20
Source File: TaskConfig.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public Partitioner<?> getOutputPartitioner(int outputNum, final ClassLoader cl) throws ClassNotFoundException {
	try {
		return (Partitioner<?>) InstantiationUtil.readObjectFromConfig(config, OUTPUT_PARTITIONER + outputNum, cl);
	}
	catch (ClassNotFoundException e) {
		throw e;
	}
	catch (Throwable t) {
		throw new RuntimeException("Could not deserialize custom partitioner.", t);
	}
}