Package net.tomp2p.dht

Examples of net.tomp2p.dht.PutBuilder


     *            The peers in this P2P network
     * @throws InterruptedException
     * @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...");
View Full Code Here


          Utils.addReleaseListener(futureChannelCreator, futureDone);
            futureChannelCreator.addListener(new BaseFutureAdapter<FutureChannelCreator>() {
                @Override
                public void operationComplete(final FutureChannelCreator future) throws Exception {
                    if (future.isSuccess()) {
                        PutBuilder putBuilder = new PutBuilder(peer, locationKey);
                        putBuilder.dataMap(dataMap);
                        FutureResponse futureResponse = storageRPC.put(other, putBuilder,
                                future.channelCreator());
                        futureResponse.addListener(new BaseFutureAdapter<FutureResponse>() {
              @Override
              public void operationComplete(FutureResponse future)
View Full Code Here

            FutureChannelCreator fcc = master.peer().connectionBean().reservation().create(0, 1);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();

            PutBuilder putBuilder = new PutBuilder(master, location);
            putBuilder.domainKey(location);
            putBuilder.dataMapContent(dataMap);
            putBuilder.versionKey(Number160.ZERO);

            FutureResponse fr = master.storeRPC().put(master.peerAddress(), putBuilder, cc);
            fr.awaitUninterruptibly();
            // s1.put(location, Number160.ZERO, null, dataMap, false, false);
            final int slavePort = 7701;
View Full Code Here

            FutureChannelCreator fcc = master.peer().connectionBean().reservation().create(0, 1);
            fcc.awaitUninterruptibly();
            cc = fcc.channelCreator();

            PutBuilder putBuilder = new PutBuilder(master, loc);
            putBuilder.domainKey(domainKey);
            putBuilder.dataMapContent(contentMap);
            putBuilder.versionKey(Number160.ZERO);

            master.storeRPC().put(master.peerAddress(), putBuilder, cc).awaitUninterruptibly();
            slave1 = new PeerBuilderDHT(new PeerBuilder(new Number160(rnd)).ports(port + 1).start()).start();
            slave2 = new PeerBuilderDHT(new PeerBuilder(new Number160(rnd)).ports(port + 2).start()).start();
            System.err.println("slave1 is " + slave1.peerAddress());
View Full Code Here

      });
     
      // create test data with given location key
      Map<Number160, Data> dataMap = new HashMap<Number160, Data>();
      dataMap.put(Number160.ZERO, new Data("string"));
      PutBuilder putBuilder = new PutBuilder(master, lKey);
      putBuilder.domainKey(Number160.ZERO);
      putBuilder.dataMapContent(dataMap);
      putBuilder.versionKey(Number160.ZERO);

      FutureChannelCreator fcc = master.peer().connectionBean().reservation().create(0, 1);
      fcc.awaitUninterruptibly();
      cc = fcc.channelCreator();
View Full Code Here

TOP

Related Classes of net.tomp2p.dht.PutBuilder

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.