Examples of FutureSend


Examples of net.tomp2p.dht.FutureSend

    }
  }

  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.dht.FutureSend

      System.err.println("got:" + object);
    }
  }

  private static void exampleSendRedundant(PeerDHT peer) {
    FutureSend futureSend = peer.send(Number160.createHash("key")).object("hello").start();
    futureSend.awaitUninterruptibly();
    for (Object object : futureSend.rawDirectData2().values()) {
      System.err.println("got:" + object);
    }

  }
View Full Code Here

Examples of net.tomp2p.futures.FutureSend

    HybridEncryptedContent encryptedMessage = signAndEncryptMessage(message, targetPublicKey);
    if (encryptedMessage == null)
      return false;

    // send message to the peer which is responsible for the given key
    FutureSend futureSend = networkManager.getConnection().getPeer()
        .send(Number160.createHash(message.getTargetKey())).setObject(encryptedMessage)
        .setRequestP2PConfiguration(createSendingConfiguration()).start();

    // attach a future listener to log, handle and notify events
    FutureRoutedListener listener = new FutureRoutedListener(message, targetPublicKey, this);
    futureSend.addListener(listener);
    boolean success = listener.await();

    if (success) {
      logger.debug("Message sent. Target key = '{}', Message ID = '{}'.",
          message.getTargetKey(), message.getMessageID());
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.