Package net.tomp2p.peers

Examples of net.tomp2p.peers.PeerStatistic.peerAddress()


            Number160 domainKey = new Number160("0x7777");
            Number320 key = new Number320(locationKey, domainKey);
           
            sender.trackerStorage().put(key, recv1.peerAddress(), null, new Data("test"));
            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
View Full Code Here


    Number320 n320 = new Number320(Number160.ZERO, Number160.ZERO);

    trackerStorage.put(n320, selfAddress, null, new Data("test"));
    PeerStatistic ps = trackerStorage.nextForMaintenance(null);
    Assert.assertEquals(ps.peerAddress().peerId(), self)
  }
 
  @Test
  public void testTrackerMaintenance2() throws IOException {
    Number160 self = Number160.ONE;
View Full Code Here

      UtilsDHT2.perfectRoutingIndirect(peers);
      // do testing

      PeerStatistic peerStatatistic = master.peerBean().peerMap()
              .nextForMaintenance(new ArrayList<PeerAddress>());
      Assert.assertNotEquals(master.peerAddress(), peerStatatistic.peerAddress());
      Thread.sleep(10000);
      System.err.println("DONE");
    } finally {
      if (master != null) {
        master.shutdown().await();
View Full Code Here

            for (Maintainable maintainable : maintainables) {
                PeerStatistic peerStatatistic = maintainable.nextForMaintenance(runningFutures.values());
                if(peerStatatistic == null) {
                    continue;
                }
                BaseFuture future = peer.ping().peerAddress(peerStatatistic.peerAddress()).start();
                LOG.debug("maintenance ping from {} to {}", peer.peerAddress(), peerStatatistic.peerAddress());
               
                peer.notifyAutomaticFutures(future);
                runningFutures.put(future, peerStatatistic.peerAddress());
                COUNTER.incrementAndGet();
View Full Code Here

                PeerStatistic peerStatatistic = maintainable.nextForMaintenance(runningFutures.values());
                if(peerStatatistic == null) {
                    continue;
                }
                BaseFuture future = peer.ping().peerAddress(peerStatatistic.peerAddress()).start();
                LOG.debug("maintenance ping from {} to {}", peer.peerAddress(), peerStatatistic.peerAddress());
               
                peer.notifyAutomaticFutures(future);
                runningFutures.put(future, peerStatatistic.peerAddress());
                COUNTER.incrementAndGet();
                future.addListener(new BaseFutureAdapter<BaseFuture>() {
View Full Code Here

                }
                BaseFuture future = peer.ping().peerAddress(peerStatatistic.peerAddress()).start();
                LOG.debug("maintenance ping from {} to {}", peer.peerAddress(), peerStatatistic.peerAddress());
               
                peer.notifyAutomaticFutures(future);
                runningFutures.put(future, peerStatatistic.peerAddress());
                COUNTER.incrementAndGet();
                future.addListener(new BaseFutureAdapter<BaseFuture>() {
                    @Override
                    public void operationComplete(BaseFuture future) throws Exception {
                      synchronized (lock) {
View Full Code Here

      peerStatatistics.remove(new PeerStatistic(self));
      if (peerStatatistics.size() == 0) {
        return null;
      }
      PeerStatistic peerStatatistic = Utils.pollRandom(peerStatatistics, rnd);
      return new TrackerTriple().key(key).data(trackerData).remotePeer(peerStatatistic.peerAddress());
    }

    @Override
        public TrackerStorage trackerStorage() {
          return trackerStorage;
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.