Examples of awaitUninterruptibly()


Examples of java.util.concurrent.locks.Condition.awaitUninterruptibly()

    shutdown = true;
    entryLock.lock();
    try {
      while (!lockMap.isEmpty()) {
        Condition cond = lockMap.values().iterator().next();
        cond.awaitUninterruptibly();
      }
    } finally {
      entryLock.unlock();
    }
  }
View Full Code Here

Examples of net.gleamynode.netty.channel.ChannelFuture.awaitUninterruptibly()

                // Ignore
            }
        } while (future == null);

        // Wait for the future.
        future.awaitUninterruptibly();
        if (!future.isSuccess()) {
            future.getChannel().close().awaitUninterruptibly();
            throw new ChannelException("Failed to bind to: " + localAddress, future.getCause());
        }
View Full Code Here

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

        PeerDHT[] peers = new PeerDHT[] {peer1, peer2, peer3};
        //
        FuturePut futurePut = peer1.put(new Number160(nr3)).data(new Data("store on peer1")).start();
        futurePut.awaitUninterruptibly();
        FutureDigest futureDigest = peer1.digest(new Number160(nr3)).start();
        futureDigest.awaitUninterruptibly();
        System.out.println("we found the data on " + futureDigest.rawDigest().size() + " peers");
        // now peer1 gets to know peer2, transfer the data
        peer1.peer().bootstrap().peerAddress(peer2.peerAddress()).start();
        peer1.peer().bootstrap().peerAddress(peer3.peerAddress()).start();
        Thread.sleep(ONE_SECOND);
View Full Code Here

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

         * @throws ClassNotFoundException .
         */
        public void list(final String nickName) throws IOException, ClassNotFoundException {
            Number160 key = Number160.createHash(nickName);
            FutureGet futureGet = peer.get(key).all().start();
            futureGet.awaitUninterruptibly();
            for (Map.Entry<Number640, Data> entry : futureGet.dataMap().entrySet()) {
                System.out.println("this peers' (" + nickName + ") friend:" + entry.getValue().object());
            }
            System.out.println("DHT reports that " + futureGet.dataMap().size() + " peer(s) are his friends");
        }
View Full Code Here

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

            final int height) throws IOException {
        Interval inter = interval;
        for (int i = 0; i <= height; i++) {
            Number160 key = Number160.createHash(inter.toString());
            FuturePut futurePut = peer.put(key).data(new Number160(index), new Data(word)).start();
            futurePut.awaitUninterruptibly();
            System.out.println("stored " + word + " in " + inter + " status: " + futurePut.isSuccess());
            inter = inter.split(index);
        }
        System.out.println("for DHT.put() we used " + (height + 1) + " DHT calls");
    }
View Full Code Here

Examples of net.tomp2p.dht.FutureSend.awaitUninterruptibly()

  private static void exampleSendOne(PeerDHT peer) {
    RequestP2PConfiguration requestP2PConfiguration = new RequestP2PConfiguration(1, 10, 0);
    FutureSend futureSend = peer.send(Number160.createHash("key")).object("hello")
            .requestP2PConfiguration(requestP2PConfiguration).start();
    futureSend.awaitUninterruptibly();
    for (Object object : futureSend.rawDirectData2().values()) {
      System.err.println("got:" + object);
    }
  }
View Full Code Here

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

  @After
  public void shutdown() {
    System.err.println("shutdown initiated!");
    for (Peer ele : peers) {
      BaseFuture bf = ele.shutdown();
      bf.awaitUninterruptibly();
    }
    BaseFuture bf = unreachable.shutdown();
    bf.awaitUninterruptibly();
    System.err.println("shutdown done!");
  }
View Full Code Here

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

            dataMap.put(new Number160(22), new Data("testme"));
            FutureAsyncTask futureAsyncTask = peer1.getAsyncTask().submit(peer2.getPeerAddress(),
                    futureChannelCreator.getChannelCreator(), taskId, dataMap, new MyWorker3(), false, false);
            Utils.addReleaseListenerAll(futureAsyncTask, peer1.getConnectionBean().getConnectionReservation(),
                    futureChannelCreator.getChannelCreator());
            futureAsyncTask.awaitUninterruptibly();
            Assert.assertEquals(true, futureAsyncTask.isSuccess());
            Assert.assertEquals("yup", futureAsyncTask.getDataMap().get(Number160.ONE).getObject());
        } catch (Throwable t) {
            t.printStackTrace();
        } finally {
View Full Code Here

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

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

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

            new NeighborRPC(sender.peerBean(), sender.connectionBean());
            recv1 = new PeerBuilder(new Number160("0x20")).p2pId(55).ports(8088).start();
            NeighborRPC neighbors2 = new NeighborRPC(recv1.peerBean(), recv1.connectionBean());
            FutureChannelCreator fcc = recv1.connectionBean().reservation().create(0, 1);

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

            SearchValues v = new SearchValues(new Number160("0x1"), null);
            DefaultConnectionConfiguration d = new DefaultConnectionConfiguration();
            d.forceTCP();
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.