use of org.apache.heron.spi.packing.PackingException in project heron by twitter.
the class LauncherUtils method createPackingPlan.
/**
* Returns a packing plan generated by configured packing class
*/
public PackingPlan createPackingPlan(final Config config, final Config runtime) throws PackingException {
// Create an instance of the packing class
String packingClass = Context.packingClass(config);
IPacking packing;
try {
// create an instance of the packing class
packing = ReflectionUtils.newInstance(packingClass);
} catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
throw new PackingException(String.format("Failed to instantiate packing instance using packing class %s", packingClass), e);
}
try {
TopologyAPI.Topology topology = Runtime.topology(runtime);
packing.initialize(config, topology);
return packing.pack();
} finally {
SysUtils.closeIgnoringExceptions(packing);
}
}
Aggregations