Class TransportAddressAgent

    • Field Detail

      • CACHE_VALIDITY_DUR

        protected static final long CACHE_VALIDITY_DUR
        Freshness limit for renewed searches.
        See Also:
        Constant Field Values
      • CACHE_INVALIDITY_DUR

        protected static final long CACHE_INVALIDITY_DUR
        Freshness limit for previously failed renewed searches.
        See Also:
        Constant Field Values
      • ASK_ALL_LIMIT

        protected static final int ASK_ALL_LIMIT
        Maximum number of peers to ask for addresses.
        See Also:
        Constant Field Values
      • localaddresses

        protected java.util.LinkedHashSet<TransportAddress> localaddresses
        The local addresses.
      • freshness

        protected java.util.Map<IComponentIdentifier,​java.lang.Long> freshness
        Freshness state of the cache.
      • addresses

        protected java.util.Map<IComponentIdentifier,​java.util.LinkedHashSet<TransportAddress>> addresses
        The managed addresses: target platform -> (transport name -> transport addresses)
      • manualaddresses

        protected java.util.Map<IComponentIdentifier,​java.util.LinkedHashSet<TransportAddress>> manualaddresses
        The managed addresses: target platform -> (transport name -> transport addresses)
      • superpeerlookup

        protected boolean superpeerlookup
      • directlookup

        protected boolean directlookup
      • pawalookup

        protected boolean pawalookup
      • awalookup

        protected boolean awalookup
      • askalllookup

        protected boolean askalllookup
    • Constructor Detail

      • TransportAddressAgent

        public TransportAddressAgent()
    • Method Detail

      • init

        public IFuture<java.lang.Void> init()
        Initializes the service.
      • getAddresses

        public IFuture<java.util.List<TransportAddress>> getAddresses​(java.lang.String transporttype)
        Gets the addresses of the local platform.
        Specified by:
        getAddresses in interface ITransportAddressService
        Parameters:
        transporttype - The transport type.
        Returns:
        Addresses of the local platform.
      • getAddresses

        public IFuture<java.util.List<TransportAddress>> getAddresses​(IComponentIdentifier platformid,
                                                                      java.lang.String transporttype)
        Gets the addresses of another platform known to the local platform.
        Specified by:
        getAddresses in interface ITransportAddressService
        Parameters:
        platformid - ID of the platform.
        transporttype - The transport type.
        Returns:
        Addresses of the platform, if known.
      • resolveAddresses

        public IFuture<java.util.List<TransportAddress>> resolveAddresses​(IComponentIdentifier platformid,
                                                                          java.lang.String transporttype)
        Recursively looks up the addresses of a platform for a specific transport type.
        Specified by:
        resolveAddresses in interface ITransportAddressService
        Parameters:
        platformid - ID of the platform.
        transporttype - The transport type.
        Returns:
        Addresses of the local platform.
      • addManualAddresses

        public IFuture<java.lang.Void> addManualAddresses​(java.util.Collection<TransportAddress> addresses)
        Adds user-specified addresses. Warning: Only use this to add manually specified addresses.
        Specified by:
        addManualAddresses in interface ITransportAddressService
        Parameters:
        addresses - Platform addresses.
        Returns:
        Null, when done.
      • hasSuperPeer

        protected boolean hasSuperPeer()
        Checks if a super peer is available.
        Returns:
        True, if super peer is available.
      • updateFromLocalAwareness

        protected void updateFromLocalAwareness​(IComponentIdentifier platformid)
        Updates the cache using the local awareness cache.
        Parameters:
        platformid - The platform ID.
      • searchAddressesByAskSuperPeer

        protected java.util.List<TransportAddress> searchAddressesByAskSuperPeer​(IComponentIdentifier platformid)
        Searches for addresses using super peer.
        Parameters:
        platformid - The platform ID.
        Returns:
        The addresses.
      • searchAddressesByAskRemote

        protected java.util.List<TransportAddress> searchAddressesByAskRemote​(IComponentIdentifier platformid)
        Searches for addresses directly asking remote platform.
        Parameters:
        platformid - The platform ID.
        Returns:
        The addresses.
      • searchAddressesByAskAwareness

        protected java.util.List<TransportAddress> searchAddressesByAskAwareness​(IComponentIdentifier platformid)
        Searches for addresses using super peer.
        Parameters:
        platformid - The platform ID.
        Returns:
        The addresses.
      • searchAddressesByAskAll

        protected java.util.List<TransportAddress> searchAddressesByAskAll​(IComponentIdentifier platformid)
        Randomly ask other platforms for addresses (search of last resort).
        Parameters:
        platformid - The platform ID.
        Returns:
        The addresses.
      • getAddressesFromCache

        protected java.util.List<TransportAddress> getAddressesFromCache​(IComponentIdentifier platformid)
        Gets platform addresses from local cache.
        Parameters:
        platformid - Platform ID.
        Returns:
        Addresses.
      • addAddresses

        protected void addAddresses​(java.util.Collection<TransportAddress> addrs)
        Adds addresses to cache.
        Parameters:
        addrs - The addresses.
      • addToManualAddressesList

        protected void addToManualAddressesList​(java.util.Collection<TransportAddress> addrs)
        Adds addresses to manual address list.
        Parameters:
        addrs - The addresses.
      • addAddresses

        protected void addAddresses​(java.util.Collection<TransportAddress> addrs,
                                    java.util.Map<IComponentIdentifier,​java.util.LinkedHashSet<TransportAddress>> addressmap)
        Adds addresses to a map.
        Parameters:
        addrs - The addresses.
        addressmap - The map of address that is the target of the operation.
      • filterAddresses

        protected java.util.List<TransportAddress> filterAddresses​(java.util.List<TransportAddress> addresses,
                                                                   java.lang.String transporttype)
        Filters addresses for transport types.
        Parameters:
        addresses - The addresses to filter.
        transporttype - The transport type.
        Returns:
        Filtered list or null of none match.