Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureResponse.awaitUninterruptibly()


            FutureResponse futureResponse2 = peer1.getTaskRPC().sendTask(peer1.getPeerAddress(),
                    futureChannelCreator.getChannelCreator(), taskId2, dataMap, new MyWorker2(), null, false, false);
            futureResponse2.awaitUninterruptibly();
            FutureResponse futureResponse3 = peer1.getTaskRPC().sendTask(peer1.getPeerAddress(),
                    futureChannelCreator.getChannelCreator(), taskId3, dataMap, new MyWorker2(), null, false, false);
            futureResponse3.awaitUninterruptibly();
            Assert.assertEquals(true, futureResponse1.isSuccess());
            Assert.assertEquals(true, futureResponse2.isSuccess());
            Assert.assertEquals(true, futureResponse3.isSuccess());
            Collection<Number160> taskIDs = new ArrayList<Number160>();
            taskIDs.add(taskId1);
View Full Code Here


            taskIDs.add(taskId1);
            taskIDs.add(taskId2);
            taskIDs.add(taskId3);
            FutureResponse futureResponse4 = peer1.getTaskRPC().taskStatus(peer1.getPeerAddress(),
                    futureChannelCreator.getChannelCreator(), taskIDs, false);
            futureResponse4.awaitUninterruptibly();
            Assert.assertEquals(3, futureResponse4.getResponse().getDataMap().size());
            Map<Number160, Data> map = futureResponse4.getResponse().getDataMap();
            TaskStatus status1 = (TaskStatus) map.get(taskId1).getObject();
            TaskStatus status2 = (TaskStatus) map.get(taskId2).getObject();
            TaskStatus status3 = (TaskStatus) map.get(taskId3).getObject();
View Full Code Here

            Thread.sleep(1000);
            FutureResponse futureResponse5 = peer1.getTaskRPC().taskStatus(peer1.getPeerAddress(),
                    futureChannelCreator.getChannelCreator(), taskIDs, false);
            Utils.addReleaseListenerAll(futureResponse5, peer1.getConnectionBean().getConnectionReservation(),
                    futureChannelCreator.getChannelCreator());
            futureResponse5.awaitUninterruptibly();
            Assert.assertEquals(3, futureResponse5.getResponse().getDataMap().size());
            map = futureResponse5.getResponse().getDataMap();
            status1 = (TaskStatus) map.get(taskId1).getObject();
            status2 = (TaskStatus) map.get(taskId2).getObject();
            status3 = (TaskStatus) map.get(taskId3).getObject();
View Full Code Here

            PingRPC handshake = new PingRPC(sender.peerBean(), sender.connectionBean());
            FutureChannelCreator fcc = sender.connectionBean().reservation().create(0, 1);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();
            FutureResponse fr = handshake.pingTCP(pa, cc, new DefaultConnectionConfiguration());
            fr.awaitUninterruptibly();
            Assert.assertEquals(true, fr.isSuccess());
            Thread.sleep(WAIT);
        } finally {
            if (cc != null) {
                cc.shutdown().await();
View Full Code Here

            PingRPC handshake = new PingRPC(sender.peerBean(), sender.connectionBean());
            FutureChannelCreator fcc = sender.connectionBean().reservation().create(0, 1);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();
            FutureResponse fr = handshake.pingTCPDiscover(pa, cc, new DefaultConnectionConfiguration());
            fr.awaitUninterruptibly();
            Assert.assertEquals(true, fr.isSuccess());
            Thread.sleep(WAIT);
        } finally {
            if (cc != null) {
                cc.shutdown().await();
View Full Code Here

            PingRPC handshake = new PingRPC(sender.peerBean(), sender.connectionBean());
            FutureChannelCreator fcc = sender.connectionBean().reservation().create(0, 1);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();
            FutureResponse fr = handshake.pingTCPProbe(pa, cc, new DefaultConnectionConfiguration());
            fr.awaitUninterruptibly();
            Assert.assertEquals(true, fr.isSuccess());
            Thread.sleep(WAIT);
        } finally {
            if (cc != null) {
                cc.shutdown().await();
View Full Code Here

            fr.progress();
            System.err.println("progres");
            // we are not done yet!

            // now we are done
            fr.awaitUninterruptibly();

            if (wait) {
                Assert.assertEquals(1, progressComplete.get());
                Assert.assertEquals(1, progressNotComplete.get());
                Assert.assertEquals(1, replyComplete.get());
View Full Code Here

                    .send(recv1.peerAddress(), sendDirectBuilder, cc);
            FutureResponse fd2 = sender.directDataRPC()
                    .send(recv1.peerAddress(), sendDirectBuilder, cc);

            fd1.awaitUninterruptibly();
            fd2.awaitUninterruptibly();

            System.err.println(fd1.failedReason());
            Assert.assertEquals(true, fd1.isSuccess());
            Assert.assertEquals(true, fd2.isSuccess());
View Full Code Here

            putBuilder.domainKey(location);
            putBuilder.dataMapContent(dataMap);
            putBuilder.versionKey(Number160.ZERO);

            FutureResponse fr = master.storeRPC().put(master.peerAddress(), putBuilder, cc);
            fr.awaitUninterruptibly();
            // s1.put(location, Number160.ZERO, null, dataMap, false, false);
            final int slavePort = 7701;
            slave = new PeerBuilderDHT(new PeerBuilder(new Number160("0xfe")).ports(slavePort).start()).start();
            master.peerBean().peerMap().peerFound(slave.peerAddress(), null, null);
            master.peerBean().peerMap().peerFailed(slave.peerAddress(), new PeerException(AbortCause.SHUTDOWN, "shutdown"));
View Full Code Here

      fcc.awaitUninterruptibly();
      cc = fcc.channelCreator();

      // put test data
      FutureResponse fr = master.storeRPC().put(master.peerAddress(), putBuilder, cc);
      fr.awaitUninterruptibly();
      Assert.assertEquals(joins[0][0], replicateI.get());
      replicateI.set(0);
      Assert.assertEquals(joins[0][1], replicateWe.get());
      replicateWe.set(0);
      Assert.assertEquals(joins[0][2], replicateOther.get());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.