Package net.tomp2p.p2p

Examples of net.tomp2p.p2p.Shutdown


     * @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


      final DirectReplicationWorker worker = new DirectReplicationWorker(builder, automaticFuture, repetitions, latch);
      ScheduledFuture<?> future = scheduledExecutorService.scheduleWithFixedDelay(worker, 0, intervalMillis,
              TimeUnit.MILLISECONDS);
      worker.future = future;
      latch.countDown();
      return new Shutdown() {
        @Override
        public BaseFuture shutdown() {
          worker.shutdown();
          return new FutureDone<Void>().done();
        }
View Full Code Here

    private List<ResponsibilityListener> responsibilityListeners = null;
   
    public IndirectReplication(PeerDHT peer) {
      this.peer = peer;

    peer.peer().addShutdownListener(new Shutdown() {
      @Override
      public BaseFuture shutdown() {
        IndirectReplication.this.shutdown();
        return new FutureDone<Void>().done();
      }
View Full Code Here

    return null;
  }

  private DistributedRelay startSetupRelay(FutureRelay futureRelay) {
    // close the relay connection when the peer is shutdown
    peer.addShutdownListener(new Shutdown() {
      @Override
      public BaseFuture shutdown() {
        return distributedRelay.shutdown();
      }
    });
View Full Code Here

      DistributedRelay distributedRelay) {
    final PeerMapUpdateTask peerMapUpdateTask = new PeerMapUpdateTask(relayRPC, bootstrapBuilder, distributedRelay,
        manualRelays, maxFail);
    peer.connectionBean().timer().scheduleAtFixedRate(peerMapUpdateTask, 0, peerMapUpdateInterval(), TimeUnit.SECONDS);

    final Shutdown shutdown = new Shutdown() {
      @Override
      public BaseFuture shutdown() {
        peerMapUpdateTask.cancel();
        return new FutureDone<Void>().done();
      }
    };
    peer.addShutdownListener(shutdown);

    return new Shutdown() {
      @Override
      public BaseFuture shutdown() {
        peerMapUpdateTask.cancel();
        peer.removeShutdownListener(shutdown);
        return new FutureDone<Void>().done();
View Full Code Here

                futureBootstrapNAT.futureBootstrap1(futureBootstrap);
                futureBootstrap.addListener(new BaseFutureAdapter<FutureBootstrap>() {
                  @Override
                  public void operationComplete(FutureBootstrap future) throws Exception {
                    if (future.isSuccess()) {
                      Shutdown shutdown = startRelayMaintenance(futureRelay, bootstrapBuilder, distributedRelay);
                      futureBootstrapNAT.done(shutdown);
                    } else {
                      futureBootstrapNAT.failed("2nd FutureBootstrap failed", future);
                    }
                  }
View Full Code Here

   
    if (peerMapUpdateInterval == -1) {
      peerMapUpdateInterval = relayType.defaultMapUpdateInterval();
    }
   
    peer.addShutdownListener(new Shutdown() {
      @Override
      public BaseFuture shutdown() {
        natUtils.shutdown();
        return new FutureDone<Void>().done();
      }
View Full Code Here

    synchronized (lock) {
      if (!completedAndNotify()) {
        return;
      }
      this.type = FutureType.OK;
      this.shutdown = new Shutdown() {
        @Override
        public BaseFuture shutdown() {
          return FutureRelayNAT.this;
        }
      };
View Full Code Here

    DistributedTracker distributedTracker = new DistributedTracker(peer.peerBean(), peer.distributedRouting(),
            trackerRPC, trackerStorage);

    final PeerTracker peerTracker = new PeerTracker(peer, scheduledFuture, trackerRPC, trackerStorage,
            peerExchange, distributedTracker);
    peer.addShutdownListener(new Shutdown() {
      @Override
      public BaseFuture shutdown() {
        peerTracker.shutdown();
        return new FutureDone<Void>().done();
      }
View Full Code Here

TOP

Related Classes of net.tomp2p.p2p.Shutdown

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.