Package net.tomp2p.p2p

Examples of net.tomp2p.p2p.AutomaticFuture


     * @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...");
      }
    });
View Full Code Here


    public void testSimpleIndirectReplicationForward() throws Exception {
        final Random rnd = new Random(42L);
        PeerDHT master = null;
        try {
            // setup
          PeerDHT[] peers = Utils2.createNodes(2, rnd, PORT, new AutomaticFuture() {
                @Override
                public void futureCreated(BaseFuture future) {
                    System.err.println("future created "+ future);
                }
            }, true);
View Full Code Here

    @Test
    public void testIndirectReplicationForward() throws Exception {
      PeerDHT master = null;
        try {
            // setup
          PeerDHT[] peers = Utils2.createNodes(NR_PEERS, RND2, PORT, new AutomaticFuture() {
                @Override
                public void futureCreated(BaseFuture future) {
                    System.err.println("future created "+ future);
                }
            }, true);
View Full Code Here

            PeerStatistic ps = sender.trackerStorage().nextForMaintenance(new ArrayList<PeerAddress>());
            FuturePing fp = sender.peer().ping().peerAddress(ps.peerAddress()).start().awaitListeners();
            Assert.assertEquals(true, fp.isSuccess());
           
           
            sender.peer().addAutomaticFuture(new AutomaticFuture() {
        @Override
        public void futureCreated(BaseFuture future) {
          if(future instanceof FutureDone) {
            future.addListener(new BaseFutureAdapter<BaseFuture>() {
              @Override
View Full Code Here

    public void testIndirectReplication1() throws Exception {
        final CountDownLatch latch = new CountDownLatch(1);
        final AtomicBoolean testCopied = new AtomicBoolean();
        PeerDHT master = null;
        try {
            AutomaticFuture af = new AutomaticFuture() {
               
                @SuppressWarnings("unchecked")
                @Override
                public void futureCreated(BaseFuture future) {
                    if(future instanceof FutureDone) {
View Full Code Here

TOP

Related Classes of net.tomp2p.p2p.AutomaticFuture

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.