use of org.apache.heron.spi.statefulstorage.IStatefulStorage in project heron by twitter.
the class CheckpointManager method init.
public void init(String topologyName, String topologyId, String checkpointMgrId, String serverHost, int serverPort, SystemConfig systemConfig, CheckpointManagerConfig checkpointManagerConfig) throws IOException, CheckpointManagerException {
LOG.info("Initializing CheckpointManager");
checkpointManagerServerLoop = new NIOLooper();
HeronSocketOptions serverSocketOptions = new HeronSocketOptions(checkpointManagerConfig.getWriteBatchSize(), checkpointManagerConfig.getWriteBatchTime(), checkpointManagerConfig.getReadBatchSize(), checkpointManagerConfig.getReadBatchTime(), checkpointManagerConfig.getSocketSendSize(), checkpointManagerConfig.getSocketReceiveSize(), checkpointManagerConfig.getMaximumPacketSize());
// Setup the IStatefulStorage
IStatefulStorage statefulStorage = setupStatefulStorage(topologyName, checkpointManagerConfig);
// Start the server
this.checkpointManagerServer = new CheckpointManagerServer(topologyName, topologyId, checkpointMgrId, statefulStorage, checkpointManagerServerLoop, serverHost, serverPort, serverSocketOptions);
}
use of org.apache.heron.spi.statefulstorage.IStatefulStorage in project heron by twitter.
the class CheckpointManager method setupStatefulStorage.
private static IStatefulStorage setupStatefulStorage(String topologyName, CheckpointManagerConfig checkpointManagerConfig) throws CheckpointManagerException {
IStatefulStorage statefulStorage;
String classname = checkpointManagerConfig.getStorageClassname();
try {
statefulStorage = (IStatefulStorage) Class.forName(classname).newInstance();
} catch (InstantiationException e) {
throw new CheckpointManagerException(classname + " class must have a no-arg constructor.", e);
} catch (IllegalAccessException e) {
throw new CheckpointManagerException(classname + " class must be concrete.", e);
} catch (ClassNotFoundException e) {
throw new CheckpointManagerException(classname + " class must be a class path.", e);
}
try {
statefulStorage.init(topologyName, Collections.unmodifiableMap(checkpointManagerConfig.getStatefulStorageConfig()));
} catch (StatefulStorageException e) {
throw new CheckpointManagerException(classname + " init threw exception", e);
}
return statefulStorage;
}
Aggregations