Package net.tomp2p.futures

Examples of net.tomp2p.futures.FuturePeerConnection.addListener()


    if (!message.neighborsSetList().isEmpty()) {
      // extract the PeerAddress from the reachable peer
      final PeerAddress originalSender = (PeerAddress) message.neighborsSetList().get(0).neighbors().toArray()[0];
      // create new PeerConnectin to the reachable peer
      final FuturePeerConnection fpc = peer.createPeerConnection(originalSender);
      fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
        @Override
        public void operationComplete(final FuturePeerConnection future) throws Exception {
          if (future.isSuccess() && future.peerConnection() != null) {
            // successfully created a connection from unreachable to the requester
            final PeerConnection peerConnection = future.peerConnection();
View Full Code Here


      }
    }

    LOG.debug("Setting up relay connection to peer {}, message {}", candidate, message);
    final FuturePeerConnection fpc = peer.createPeerConnection(candidate);
    fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
      public void operationComplete(final FuturePeerConnection futurePeerConnection) throws Exception {
        if (futurePeerConnection.isSuccess()) {
          // successfully created a connection to the relay peer
          final PeerConnection peerConnection = futurePeerConnection.object();
View Full Code Here

   * @return
   */
  public static FutureResponse connectAndSend(final Peer peer, final Message message, final ConnectionConfiguration config) {
    final FutureResponse futureResponse = new FutureResponse(message);
    final FuturePeerConnection fpc = peer.createPeerConnection(message.recipient());
    fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
            public void operationComplete(final FuturePeerConnection futurePeerConnection) throws Exception {
                if (futurePeerConnection.isSuccess()) {
                  // successfully created a connection to the other peer
                  final PeerConnection peerConnection = futurePeerConnection.object();
                 
View Full Code Here

  public FutureDone<PeerConnection> startSetupRcon(final PeerAddress relayPeerAddress, final PeerAddress unreachablePeerAddress) {
    checkRconPreconditions(relayPeerAddress, unreachablePeerAddress);

    final FutureDone<PeerConnection> futureDone = new FutureDone<PeerConnection>();
    final FuturePeerConnection fpc = peer.createPeerConnection(relayPeerAddress);
    fpc.addListener(new BaseFutureAdapter<FuturePeerConnection>() {
      // wait for the connection to the relay Peer
      @Override
      public void operationComplete(FuturePeerConnection future) throws Exception {
        if (fpc.isSuccess()) {
          final PeerConnection peerConnection = fpc.peerConnection();
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.