// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.clustercontroller.utils.communication.async; public abstract class SuccessfulAsyncCallback implements AsyncCallback { private final AsyncOperationImpl target; public SuccessfulAsyncCallback(final AsyncOperationImpl target) { this.target = target; } public void done(AsyncOperation sourceOp) { if (sourceOp.isSuccess()) { successfullyDone(sourceOp); } else { target.setFailure(sourceOp.getCause()); } } public abstract void successfullyDone(AsyncOperation op); }