private SerializedDeploymentUnit createSerializedUnit(DeploymentUnit deploymentUnit) throws IOException { List<CompensatableCommand> provisionCommands = deploymentUnit.getProvisionCommands(); byte[] serializedProvisionCommands = serializationService.serialize((Serializable) provisionCommands); List<CompensatableCommand> extensionCommands = deploymentUnit.getExtensionCommands(); byte[] serializedExtensionCommands = serializationService.serialize((Serializable) extensionCommands); List<CompensatableCommand> commands = deploymentUnit.getCommands(); byte[] serializedCommands = serializationService.serialize((Serializable) commands); return new SerializedDeploymentUnit(serializedProvisionCommands, serializedExtensionCommands, serializedCommands); } }
public void execute(RuntimeUpdateCommand command) throws ContainerException { String runtimeName = command.getRuntimeName(); monitor.updateRequest(runtimeName); String zone = command.getZoneName(); // A full generation must be performed since the runtime requesting the update has no previous deployment state (i.e. it is booting). // The full and current deployment will therefore be the same. DeploymentUnit unit = regenerate(zone); List<CompensatableCommand> provisionCommands = unit.getProvisionCommands(); byte[] serializedProvisionCommands = serialize((Serializable) provisionCommands); List<CompensatableCommand> extensionCommands = unit.getExtensionCommands(); byte[] serializedExtensionCommands = serialize((Serializable) extensionCommands); List<CompensatableCommand> commands = unit.getCommands(); byte[] serializedCommands = serialize((Serializable) commands); SerializedDeploymentUnit serializedUnit = new SerializedDeploymentUnit(serializedProvisionCommands, serializedExtensionCommands, serializedCommands); DeploymentCommand deploymentCommand = new DeploymentCommand(zone, serializedUnit, serializedUnit); RuntimeUpdateResponse response = new RuntimeUpdateResponse(deploymentCommand); command.setResponse(response); monitor.sendingUpdate(runtimeName); }