blob: 0572465aac56940c66598d46f07f45ebacc2d907 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// Copyright 2016 Yahoo Inc. 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);
}
|