use of com.linkedin.d2.balancer.D2ClientBuilder in project incubator-gobblin by apache.
the class D2ClientProxy method buildClient.
private D2Client buildClient(D2ClientBuilder builder) {
D2Client d2 = builder.build();
final SettableFuture<None> d2ClientFuture = SettableFuture.create();
d2.start(new Callback<None>() {
@Override
public void onError(Throwable e) {
d2ClientFuture.setException(e);
}
@Override
public void onSuccess(None none) {
d2ClientFuture.set(none);
}
});
try {
// Synchronously wait for d2 to start
d2ClientFuture.get();
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
return d2;
}
Aggregations