return distributedRelay;
}
private Shutdown startRelayMaintenance(final FutureRelay futureRelay, BootstrapBuilder bootstrapBuilder,
DistributedRelay distributedRelay) {
final PeerMapUpdateTask peerMapUpdateTask = new PeerMapUpdateTask(relayRPC, bootstrapBuilder, distributedRelay,
manualRelays, maxFail);
peer.connectionBean().timer().scheduleAtFixedRate(peerMapUpdateTask, 0, peerMapUpdateInterval(), TimeUnit.SECONDS);
final Shutdown shutdown = new Shutdown() {
@Override
public BaseFuture shutdown() {
peerMapUpdateTask.cancel();
return new FutureDone<Void>().done();
}
};
peer.addShutdownListener(shutdown);
return new Shutdown() {
@Override
public BaseFuture shutdown() {
peerMapUpdateTask.cancel();
peer.removeShutdownListener(shutdown);
return new FutureDone<Void>().done();
}
};
}