@Override public void restartContainerAsync(ContainerId containerId){ if (!(callbackHandler instanceof AbstractCallbackHandler)) { LOG.error("Callback handler does not implement container restart " + "callback methods"); return; } AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler; if (containers.get(containerId) == null) { handler.onContainerRestartError( containerId, RPCUtil.getRemoteException( "Container " + containerId + " is not started")); } try { events.put(new ContainerEvent(containerId, client.getNodeIdOfStartedContainer(containerId), null, ContainerEventType.RESTART_CONTAINER)); } catch (InterruptedException e) { LOG.warn("Exception when scheduling the event of restart of " + "Container " + containerId); handler.onContainerRestartError(containerId, e); } }
@Override public void commitLastReInitializationAsync(ContainerId containerId){ if (!(callbackHandler instanceof AbstractCallbackHandler)) { LOG.error("Callback handler does not implement container commit last " + "re-initialization callback methods"); return; } AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler; if (containers.get(containerId) == null) { handler.onCommitLastReInitializationError( containerId, RPCUtil.getRemoteException( "Container " + containerId + " is not started")); } try { events.put(new ContainerEvent(containerId, client.getNodeIdOfStartedContainer(containerId), null, ContainerEventType.COMMIT_LAST_REINT)); } catch (InterruptedException e) { LOG.warn("Exception when scheduling the event Commit re-initialization" + " of Container " + containerId); handler.onCommitLastReInitializationError(containerId, e); } }
@Override public void rollbackLastReInitializationAsync(ContainerId containerId){ if (!(callbackHandler instanceof AbstractCallbackHandler)) { LOG.error("Callback handler does not implement container rollback " + "callback methods"); return; } AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler; if (containers.get(containerId) == null) { handler.onRollbackLastReInitializationError( containerId, RPCUtil.getRemoteException( "Container " + containerId + " is not started")); } try { events.put(new ContainerEvent(containerId, client.getNodeIdOfStartedContainer(containerId), null, ContainerEventType.ROLLBACK_LAST_REINIT)); } catch (InterruptedException e) { LOG.warn("Exception when scheduling the event Rollback re-initialization" + " of Container " + containerId); handler.onRollbackLastReInitializationError(containerId, e); } }
@Override public void reInitializeContainerAsync(ContainerId containerId, ContainerLaunchContext containerLaunchContex, boolean autoCommit){ if (!(callbackHandler instanceof AbstractCallbackHandler)) { LOG.error("Callback handler does not implement container re-initialize " + "callback methods"); return; } AbstractCallbackHandler handler = (AbstractCallbackHandler) callbackHandler; if (containers.get(containerId) == null) { handler.onContainerReInitializeError( containerId, RPCUtil.getRemoteException( "Container " + containerId + " is not started")); } try { events.put(new ReInitializeContainerEvevnt(containerId, client.getNodeIdOfStartedContainer(containerId), containerLaunchContex, autoCommit)); } catch (InterruptedException e) { LOG.warn("Exception when scheduling the event of re-initializing of " + "Container " + containerId); handler.onContainerReInitializeError(containerId, e); } }