Package net.tomp2p.p2p

Examples of net.tomp2p.p2p.RequestP2PConfiguration


  @Override
  public void sendMessage(String key, String message) {
    l.log(TYPE_SEND, String.format("Peer %s sends message: %s to key %s",
        p, message, key), 10);
    Number160 locKey = Number160.createHash(key);
    RequestP2PConfiguration reqParam = new RequestP2PConfiguration(1, 1, 0);
    p.send(locKey).setObject(message).setRefreshSeconds(0)
        .setDirectReplication(false)
        .setRequestP2PConfiguration(reqParam).start();
  }
View Full Code Here


    configureCallbackHandlerIfNeeded(message);
    setSenderPublicKeyIfNeeded(message);
  }

  private RequestP2PConfiguration createSendingConfiguration() {
    return new RequestP2PConfiguration(1, 10, 0);
  }
View Full Code Here

      master.shutdown();
    }
  }

  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

        }
        if (routingConfiguration == null) {
            routingConfiguration = new RoutingConfiguration(3, 5, 10, 2);
        }
        if (requestP2PConfiguration == null) {
            requestP2PConfiguration = new RequestP2PConfiguration(1, 0, 1);
        }
        if (futureChannelCreator == null) {
            futureChannelCreator = peer.reserve(routingConfiguration, requestP2PConfiguration, "submit-builder");
        }
        return peer.getDistributedTask().submit(locationKey, dataMap, worker, routingConfiguration,
View Full Code Here

        }
        if (routingConfiguration == null) {
            routingConfiguration = new RoutingConfiguration(5, 10, 2);
        }
        if (requestP2PConfiguration == null) {
            requestP2PConfiguration = new RequestP2PConfiguration(3, 5, 3);
        }
        int size = peer.peer().peerBean().peerMap().size() + 1;
        requestP2PConfiguration = requestP2PConfiguration.adjustMinimumResult(size);
        if (futureChannelCreator == null ||
            (futureChannelCreator.channelCreator()!=null && futureChannelCreator.channelCreator().isShutdown())) {
View Full Code Here

            IndirectReplication i3 = new IndirectReplication(p3);
            i3.start();
           
            Utils2.perfectRouting(p1, p2, p3);
            Number160 locationKey = Number160.createHash("test1");
            FuturePut fp = p2.put(locationKey).data(new Data("hallo")).requestP2PConfiguration(new RequestP2PConfiguration(2, 10, 0)).start();
            fp.awaitUninterruptibly();
            getReplicasCount(locationKey, p1, p2, p3);
            //
            p3.peer().announceShutdown().start().awaitUninterruptibly();
            p3.shutdown().awaitUninterruptibly();
View Full Code Here

           
           
           
            Utils2.perfectRouting(p1, p2, p3);
            Number160 locationKey = Number160.createHash("test1");
            FuturePut fp = p2.put(locationKey).data(new Data("hallo")).requestP2PConfiguration(new RequestP2PConfiguration(2, 10, 0)).start();
            fp.awaitUninterruptibly();
            getReplicasCount(locationKey, p1, p2, p3);
           
            p3.peer().announceShutdown().start().awaitUninterruptibly();
            p3.shutdown().awaitUninterruptibly();
View Full Code Here

  }

  static void p1SendNext(final PeerDHT p, final Number160 idP2) {
    p1Counter++;
    p.send(idP2).object(p1Counter - 1).requestP2PConfiguration(new RequestP2PConfiguration(1, 5, 0)).start()
            .addListener(new BaseFutureListener<FutureSend>() {

              @Override
              public void operationComplete(FutureSend future) throws Exception {
View Full Code Here

  }

  static void p2SendNext(final PeerDHT p, final Number160 idP1) {
    p2Counter++;
    p.send(idP1).object(p2Counter - 1).requestP2PConfiguration(new RequestP2PConfiguration(1, 5, 0)).start()
            .addListener(new BaseFutureListener<FutureSend>() {

              @Override
              public void operationComplete(FutureSend future) throws Exception {
View Full Code Here

    this.avgSleepTime = avgSleepTime;
    this.avgBytes = avgBytes;
    this.random = new Random();
    this.validKeys = new ArrayList<Number160>();
    this.routingConfig = new RoutingConfiguration(5, 1, 1);
    this.requestConfig = new RequestP2PConfiguration(1, 1, 0);
    this.putStats = new DHTQueryStatistics();
    this.getStats = new DHTQueryStatistics();
    this.rmvStats = new DHTQueryStatistics();
  }
View Full Code Here

TOP

Related Classes of net.tomp2p.p2p.RequestP2PConfiguration

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.