Package net.tomp2p.futures

Examples of net.tomp2p.futures.FutureResponse.request()


      storePeerConnection(message, peerConnection);
      responder.response(createResponseMessage(message, Type.OK).keepAlive(true));
    } else {
      ConcurrentHashMap<Integer, FutureResponse> cachedRequests = peer.connectionBean().sender().cachedRequests();
      final FutureResponse cachedRequest = cachedRequests.remove(message.intAt(0));
      final Message cachedMessage = cachedRequest.request();
      LOG.debug("This reverse connection is only used for sending a direct message {}", cachedMessage);

      // send the message to the unreachable peer through the open channel
      FutureResponse futureResponse = RelayUtils.send(peerConnection, peer.peerBean(), peer.connectionBean(), config,
          cachedMessage);
View Full Code Here


      if (pendingRequest != null) {
        // we waited for this response, answer it
        pendingRequest.response(realMessage);

        // send ok, not fire and forget - style
        LOG.debug("Successfully answered pending request {} with {}", pendingRequest.request(), realMessage);
        responder.response(createResponseMessage(message, Type.OK, message.recipient()));
      } else {
        // handle Relayed <--> Relayed.
        // This could be a pending message for one of the relayed peers, not for this peer
        BaseRelayForwarderRPC forwarder = forwarders.get(realMessage.recipient().peerId());
View Full Code Here

                && futureResponse.responseMessage().type() == Type.DENIED;
        boolean isPartial = futureResponse != null && futureResponse.responseMessage() != null
                && futureResponse.responseMessage().type() == Type.PARTIALLY_OK;
        if (future.isSuccess() || isFull) {
          if (!isFull) {
            successAsked.add(futureResponse.request().recipient());
          }
          TrackerData newDataMap = futureResponse.responseMessage().trackerData(0);
          if (newDataMap != null) {
            Collection<PeerStatistic> newPeers = newDataMap.peerAddresses().keySet();
            mergeDiff(secondaryQueue, newPeers, alreadyAsked, queueToAsk);
View Full Code Here

          }
          TrackerData newDataMap = futureResponse.responseMessage().trackerData(0);
          if (newDataMap != null) {
            Collection<PeerStatistic> newPeers = newDataMap.peerAddresses().keySet();
            mergeDiff(secondaryQueue, newPeers, alreadyAsked, queueToAsk);
            storeResult(peerOnTracker, newDataMap, futureResponse.request().recipient(), knownPeers);
            for(PeerStatistic peerStatatistic:newPeers) {
              secondaryQueue.add(peerStatatistic.peerAddress());
            }
          }
          int successRequests = isFull ? successfulRequests.get() : successfulRequests.incrementAndGet();
View Full Code Here

          LOG.debug("evaluation result: finished={}, {} / {}", finished, peerOnTracker.size(),
                  atLeastEntriesFromTrackers);
          // if peer reported that he can provide more data, we keep
          // the peer in the list
          if (!finished && isPartial) {
            LOG.debug("partial1: {}, secondaryQueue {}", futureResponse.request().recipient(), queueToAsk);
            queueToAsk.add(futureResponse.request().recipient());
          }
          if (!finished && isFull) {
            LOG.debug("tracker reported to be full. Check if finished due to full trackers.");
            finished = trackerFull.incrementAndGet() >= maxTrackerFull;
View Full Code Here

                  atLeastEntriesFromTrackers);
          // if peer reported that he can provide more data, we keep
          // the peer in the list
          if (!finished && isPartial) {
            LOG.debug("partial1: {}, secondaryQueue {}", futureResponse.request().recipient(), queueToAsk);
            queueToAsk.add(futureResponse.request().recipient());
          }
          if (!finished && isFull) {
            LOG.debug("tracker reported to be full. Check if finished due to full trackers.");
            finished = trackerFull.incrementAndGet() >= maxTrackerFull;
          }
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.