* @throws InterruptedException
* @throws IOException .
*/
private static void exmpleDirectReplication(final PeerDHT[] peers) throws IOException, InterruptedException {
PutBuilder putBuilder = peers[1].put(Number160.ONE).data(new Data("test"));
DirectReplication replication = new DirectReplication(peers[1].peer());
Shutdown shutdown = replication.start(putBuilder, 1000, -1, new AutomaticFuture() {
@Override
public void futureCreated(BaseFuture future) {
System.out.println("put again...");
}
});
Thread.sleep(NINE_SECONDS);
System.out.println("stop replication");
shutdown.shutdown();
RemoveBuilder removeBuilder = peers[1].remove(Number160.ONE);
replication.start(removeBuilder, 1000, 9, new AutomaticFuture() {
@Override
public void futureCreated(BaseFuture future) {
System.out.println("remove again...");
}
});
Thread.sleep(NINE_SECONDS);
System.out.println("done");
replication.shutdown().awaitUninterruptibly();
}