Esempio n. 1
0
  /**
   * Set the encapsulated Peer Advertisement.
   *
   * @param adv is the RdvAdvertisement to be set.
   * @return RdvAdvertisement the old Advertisement of the Peer represented by this object
   */
  RdvAdvertisement setRdvAdvertisement(RdvAdvertisement adv) {

    if (!radv.getPeerID().equals(adv.getPeerID())) {
      if (LOG.isEnabledFor(Level.ERROR)) {
        LOG.error("adv refers to a different peer");
      }

      throw new IllegalArgumentException("adv refers to a different peer");
    }

    RdvAdvertisement old = radv;

    this.radv = adv;

    setLastUpdateTime(TimeUtils.timeNow());

    return old;
  }
Esempio n. 2
0
  /**
   * Initialize from a RdvAdvertisement.
   *
   * @param rendezvous The rendezvous the element works for.
   * @param adv the RdvAdvertisement from which to initialize
   */
  PeerViewElement(EndpointService endpoint, RdvAdvertisement radv) {

    super(radv.getPeerID());

    this.endpoint = endpoint;
    this.radv = radv;

    created = TimeUtils.timeNow();
    lastUpdate = created;
  }