@Init public void init() { executorRegistry.register(ChannelConnectionCommand.class, this); }
public void execute(ChannelConnectionCommand command) throws ExecutionException { // detach must be executed first so attachers can drop connections prior to adding new ones for (DetachChannelConnectionCommand detachCommand : command.getDetachCommands()) { executorRegistry.execute(detachCommand); } for (DisposeChannelCommand disposeCommand : command.getDisposeChannelCommands()) { executorRegistry.execute(disposeCommand); } if (command.getDisposeChannelCommands() != null) { } for (BuildChannelCommand buildCommand : command.getBuildChannelCommands()) { executorRegistry.execute(buildCommand); } for (AttachChannelConnectionCommand attachCommand : command.getAttachCommands()) { executorRegistry.execute(attachCommand); } } }
/** * Executes the commands, performing a rollback on error. * * @param commands the commands * @throws DeploymentException if a deployment error occurs */ private void execute(List<CompensatableCommand> commands) throws DeploymentException { int marker = 0; for (Command command : commands) { try { executorRegistry.execute(command); ++marker; } catch (ExecutionException e) { rollback(commands, marker); throw new DeploymentException(e); } } }
@Init public void init() { executorRegistry.register(BuildChannelCommand.class, this); }
public void execute(ConnectionCommand command) throws ExecutionException { URI uri = command.getComponentUri(); Component component = componentManager.getComponent(uri); if (component == null) { throw new ExecutionException("Component not found: " + uri); } component.startUpdate(); // detach must be executed first so wire attachers can drop connection prior to adding new ones for (DetachWireCommand detachWireCommand : command.getDetachCommands()) { commandExecutorRegistry.execute(detachWireCommand); } for (AttachWireCommand attachWireCommand : command.getAttachCommands()) { commandExecutorRegistry.execute(attachWireCommand); } component.endUpdate(); } }
@Init public void init() { executorRegistry.register(AttachChannelConnectionCommand.class, this); }
public XMLStreamReader onRequest(XMLStreamReader reader) { try { LinkedHashSet<Command> commands = marshalService.unmarshall(LinkedHashSet.class, reader); for (Command command : commands) { executorRegistry.execute(command); } monitor.executed(); } catch (MarshalException e) { monitor.error(e); } catch (ExecutionException e) { monitor.error(e); // TODO send error notification back to controller } return null; } }
@Init public void init() { commandExecutorRegistry.register(UnprovisionClassloaderCommand.class, this); }
/** * Rolls back the runtime state after a failed deployment by executing a collection of compensating commands. * * @param commands the deployment commands that failed * @param marker the deployment command index where the failure occurred */ private void rollback(List<CompensatableCommand> commands, int marker) { try { monitor.rollback("local"); ListIterator<CompensatableCommand> iter = commands.listIterator(marker); while (iter.hasPrevious()) { CompensatableCommand command = iter.previous(); Command compensating = command.getCompensatingCommand(); executorRegistry.execute(compensating); } if (scopeRegistry != null) { scopeRegistry.getScopeContainer(Scope.COMPOSITE).reinject(); } } catch (ExecutorNotFoundException ex) { // this is thrown when an error occurs during bootstrap: some of the command executors may not have be deployed at this point, which // results in an ExecutorNotFoundException. Log an ignore monitor.rollbackAborted(); } catch (ExecutionException ex) { monitor.rollbackError("local", ex); } catch (InstanceLifecycleException ex) { monitor.rollbackError("local", ex); } }
@Init public void init() { commandExecutorRegistry.register(AttachExtensionCommand.class, this); }
public void receive(Message msg) { try { String runtimeName = org.jgroups.util.UUID.get(msg.getSrc()); monitor.receiveMessage(runtimeName); Command command = (Command) helper.deserialize(msg.getBuffer()); executorRegistry.execute(command); } catch (MessageException e) { monitor.error("Error receiving message from: " + runtimeName, e); } catch (ExecutionException e) { monitor.error("Error receiving message from: " + runtimeName, e); } }
@Init public void init() { commandExecutorRegistry.register(UnProvisionExtensionsCommand.class, this); }
try { DeploymentCommand deploymentCommand = updateResponse.getDeploymentCommand(); executorRegistry.execute(deploymentCommand); } catch (ExecutionException e) { throw new MessageException(e);
@Init public void init() { commandExecutorRegistry.register(BuildComponentCommand.class, this); }
assert deserialized instanceof ResponseCommand; ResponseCommand command = (ResponseCommand) deserialized; executorRegistry.execute(command); Response response = command.getResponse(); response.setRuntimeName(runtimeName);
@Init public void init() { commandExecutorRegistry.register(DetachWireCommand.class, this); }
@Init public void init() { commandExecutorRegistry.register(ProvisionClassloaderCommand.class, this); }
@Init public void init() { commandExecutorRegistry.register(DetachChannelConnectionCommand.class, this); }
@Init public void init() { executorRegistry.register(DisposeComponentCommand.class, this); }
@Init public void init() { executorRegistry.register(StopContextCommand.class, this); }