Source:
protected Void copySnapshotAsyncCallback(AsyncCallbackDispatcher<SnapshotServiceImpl, CopyCommandResult> callback, CopySnapshotContext<CommandResult> context) { CopyCommandResult result = callback.getResult(); SnapshotInfo destSnapshot = context.destSnapshot; SnapshotObject srcSnapshot = (SnapshotObject)context.srcSnapshot; Object payload = srcSnapshot.getPayload(); CreateSnapshotPayload createSnapshotPayload = (CreateSnapshotPayload)payload; AsyncCallFuture<SnapshotResult> future = context.future; SnapshotResult snapResult = new SnapshotResult(destSnapshot, result.getAnswer()); if (result.isFailed()) { try { if (createSnapshotPayload.getSeparateBackup()) { destSnapshot.processEvent(Event.OperationFailed); throw new NoTransitionException("Failed in creating backup retrying"); } else { destSnapshot.processEvent(Event.OperationFailed); srcSnapshot.processEvent(Event.DestroyRequested); srcSnapshot.processEvent(Event.OperationSuccessed); srcSnapshot.processEvent(Snapshot.Event.OperationFailed); _snapshotDao.remove(srcSnapshot.getId()); } } catch (NoTransitionException e) { s_logger.debug("Failed to update state: " + e.toString()); } snapResult.setResult(result.getResult()); future.complete(snapResult); return null; } try { CopyCmdAnswer copyCmdAnswer = (CopyCmdAnswer)result.getAnswer(); destSnapshot.processEvent(Event.OperationSuccessed, copyCmdAnswer); srcSnapshot.processEvent(Snapshot.Event.OperationSucceeded); snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), copyCmdAnswer); future.complete(snapResult); } catch (Exception e) { s_logger.debug("Failed to update snapshot state", e); snapResult.setResult(e.toString()); future.complete(snapResult); } return null; }

Target:
protected Void copySnapshotAsyncCallback(AsyncCallbackDispatcher<SnapshotServiceImpl, CopyCommandResult> callback, CopySnapshotContext<CommandResult> context) { CopyCommandResult result = callback.getResult(); SnapshotInfo destSnapshot = context.destSnapshot; SnapshotObject srcSnapshot = (SnapshotObject)context.srcSnapshot; Object payload = srcSnapshot.getPayload(); CreateSnapshotPayload createSnapshotPayload = (CreateSnapshotPayload)payload; AsyncCallFuture<SnapshotResult> future = context.future; SnapshotResult snapResult = new SnapshotResult(destSnapshot, result.getAnswer()); if (result.isFailed()) { try { if (createSnapshotPayload.getAsyncBackup()) { destSnapshot.processEvent(Event.OperationFailed); throw new SnapshotBackupException("Failed in creating backup of snapshot with ID "+srcSnapshot.getId()); } else { destSnapshot.processEvent(Event.OperationFailed); cleanupOnSnapshotBackupFailure(context.srcSnapshot); } } catch (SnapshotBackupException e) { s_logger.debug("Failed to create backup: " + e.toString()); } snapResult.setResult(result.getResult()); future.complete(snapResult); return null; } try { CopyCmdAnswer copyCmdAnswer = (CopyCmdAnswer)result.getAnswer(); destSnapshot.processEvent(Event.OperationSuccessed, copyCmdAnswer); srcSnapshot.processEvent(Snapshot.Event.OperationSucceeded); snapResult = new SnapshotResult(_snapshotFactory.getSnapshot(destSnapshot.getId(), destSnapshot.getDataStore()), copyCmdAnswer); future.complete(snapResult); } catch (Exception e) { s_logger.debug("Failed to update snapshot state", e); snapResult.setResult(e.toString()); future.complete(snapResult); } return null; }