Examples of awaitUninterruptibly()


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

    final Number160 hash = Number160.createHash(locationKey);
    FutureDHT request;
    try {
      request = p.get(hash).setRequestP2PConfiguration(reqParam).setAll()
          .start();
      request.awaitUninterruptibly();
      Data f = request.getData();
      if (!request.isSuccess() || f == null) {
        logger.debug(String.format("Got no triple in key \"%s\" (%s)",
            locationKey, hash));
        return new ArrayList<Triple>(0);
View Full Code Here

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

    Assert.assertTrue(ttl > futureGet.getData().ttlSeconds());

    // check decrement of ttl through a get meta
    FutureDigest futureDigest = p1.digest(lKey).setDomainKey(dKey).setContentKey(cKey)
        .setVersionKey(vKey).returnMetaValues().start();
    futureDigest.awaitUninterruptibly();
    Assert.assertTrue(futureDigest.isSuccess());
    Data dataMeta = futureDigest.getDigest().dataMap().values().iterator().next();
    Assert.assertTrue(ttl > dataMeta.ttlSeconds());

    // wait again a moment, till data gets expired
View Full Code Here

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

                });

                FuturePeerConnection futurePeerConnection = peer1DHT.peer().createPeerConnection(peer2DHT.peer()
                                                                                                         .peerAddress(), 500);
                FutureDirect futureDirect = peer1DHT.peer().sendDirect(futurePeerConnection).object("hallo").start();
                futureDirect.awaitUninterruptibly();


                countDownLatch.await(3, TimeUnit.SECONDS);
                if (countDownLatch.getCount() > 0)
                    Assert.fail("The test method did not complete successfully!");
View Full Code Here

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

      // Future Discover
      FutureDiscover futureDiscover = peer.discover()
          .setInetAddress(masterPeerAddress).setPorts(masterPeerPort)
          .start();
      futureDiscover.awaitUninterruptibly();
      logger.info(String.format("Discover of %s %s", pa,
          (futureDiscover.isSuccess()) ? "succeeded" : "failed"));
      // Future Bootstrap - slave
      FutureBootstrap futureBootstrap = peer.bootstrap()
          .setInetAddress(masterPeerAddress).setPorts(masterPeerPort)
View Full Code Here

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

    FutureGet futureGet = null;
    do {
      w.tickASecond();
      futureGet = nodeB.getDataManager().getUnblocked(
          new Parameters().setLocationKey(nodeA.getNodeId()).setContentKey(contentKey));
      futureGet.awaitUninterruptibly();
    } while (futureGet.getData() == null);

    // load and verify if same secret was shared
    String receivedSecret = ((H2HTestData) futureGet.getData().object()).getTestString();
    futureGet = nodeB.getDataManager().getUnblocked(
View Full Code Here

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

    assertNotEquals(Number160.ZERO, data.getVersionKey());
    Parameters parameters = new Parameters().setLocationKey(locationKey).setContentKey(contentKey)
        .setVersionKey(data.getVersionKey()).setData(data);

    FuturePut futurePut = node.getDataManager().putUnblocked(parameters);
    futurePut.awaitUninterruptibly();
    futurePut.getFutureRequests().awaitUninterruptibly();

    assertFalse(futurePut.getRawResult().isEmpty());
    for (PeerAddress peerAddress : futurePut.getRawResult().keySet()) {
      for (Number640 key : futurePut.getRawResult().get(peerAddress).keySet()) {
View Full Code Here

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

        .remove(Number160.createHash(locationKey))
        .from(new Number640(Number160.createHash(locationKey), Number160.ZERO, Number160
            .createHash(contentKey), Number160.ZERO))
        .to(new Number640(Number160.createHash(locationKey), Number160.ZERO, Number160
            .createHash(contentKey), Number160.MAX_VALUE)).start();
    futureRemove.awaitUninterruptibly();

    FutureDigest futureDigest = p1
        .digest(Number160.createHash(locationKey))
        .from(new Number640(Number160.createHash(locationKey), Number160.ZERO, Number160
            .createHash(contentKey), Number160.ZERO))
View Full Code Here

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

            SearchValues v = new SearchValues(new Number160("0x1"), null, bf);
            FutureResponse fr = neighbors2.closeNeighbors(sender.peerAddress(), v,
                    Type.REQUEST_2, cc, new DefaultConnectionConfiguration());

            fr.awaitUninterruptibly();
            // Thread.sleep(10000000);
            Assert.assertEquals(true, fr.isSuccess());
            NeighborSet pas = fr.responseMessage().neighborsSet(0);
            // we are able to fit 40 neighbors into 1400 bytes
            Assert.assertEquals(33, pas.size());
View Full Code Here

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

            routingBuilder.parallel(2);

            FutureRouting fr = peers[0].distributedRouting().route(routingBuilder, request, cc);

            // new RoutingBuilder(peers[6].getPeerID(), null, null, 0, 0, 0, 100, 2, false), Type.REQUEST_2, cc);
            fr.awaitUninterruptibly();
            // do verification
            Assert.assertEquals(true, fr.isSuccess());
            SortedSet<PeerAddress> ns = fr.potentialHits();
            Assert.assertEquals(peers[5].peerAddress(), ns.first());
        } finally {
View Full Code Here

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

            Utils2.perfectRouting(peers);
            // do testing
            Number160 locationKey = new Number160(rnd);
            FutureTask ft = peers[12].submit(locationKey, new Worker2())
                    .setRequestP2PConfiguration(new RequestP2PConfiguration(1, 0, 0)).start();
            ft.awaitUninterruptibly();
            Assert.assertEquals(true, ft.isSuccess());
            Assert.assertEquals(1, ft.getRawDataMap().size());
        } finally {
            System.out.println("done");
            master.halt();
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.