blob: 951bf6d8df423045412afb81aad734bc392bab76 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Copyright Vespa.ai. 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<Source, Target> implements AsyncCallback<Source> {
private final AsyncOperationImpl<Target> target;
public SuccessfulAsyncCallback(final AsyncOperationImpl<Target> target) {
this.target = target;
}
public void done(AsyncOperation<Source> sourceOp) {
if (sourceOp.isSuccess()) {
successfullyDone(sourceOp);
} else {
target.setFailure(sourceOp.getCause());
}
}
public abstract void successfullyDone(AsyncOperation<Source> op);
}
|