Class PeerTable

java.lang.Object
com.bea.wcp.diameter.PeerTable

public final class PeerTable extends Object
The peer table manages information about configured Diameter peers.
Author:
Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  • Field Details

    • DEFAULT_PEER_RETRY_DELAY

      public static final int DEFAULT_PEER_RETRY_DELAY
      Default connection retry in second.s
      See Also:
    • DEFAULT_REQUEST_TIMEOUT

      public static final long DEFAULT_REQUEST_TIMEOUT
      Default request timeout in milliseconds.
      See Also:
    • DEFAULT_MAXIMUM_ATTEMPTS

      public static final int DEFAULT_MAXIMUM_ATTEMPTS
      See Also:
    • DEFAULT_WATCHDOG_TIMEOUT

      public static final int DEFAULT_WATCHDOG_TIMEOUT
      Default watchdog timeout in seconds.
      See Also:
    • WATCHDOG_TICK_RESOLUTION

      public static final int WATCHDOG_TICK_RESOLUTION
      Watchdog period in milliiseconds.
      See Also:
  • Method Details

    • getPeer

      public Peer getPeer(String host)
    • getPeerByAddress

      public Peer getPeerByAddress(InetAddress address)
    • getPeerWithoutCreation

      public Peer getPeerWithoutCreation(String host)
    • addPeer

      public void addPeer(Peer peer)
    • addPeerIpAddressToHostIdMapping

      public void addPeerIpAddressToHostIdMapping(Peer peer, String host)
    • addPeer

      public void addPeer(String host, InetAddress addr, int port)
    • listPeers

      public List<String> listPeers()
      Lists all known peer host names.
      Returns:
      Hostname of all peers
    • start

      public void start()
    • scheduleReconnect

      public void scheduleReconnect(Peer peer)
      Schedules a timer task to reconnect to a peer after a configured peerRetryDelay (specified as timer "Tc" in RFC3588). The default is to reconnect after 30 seconds.
      Parameters:
      peer - the peer to reconnect to after the configured peerRetryDelay
    • scheduleWatchdogTick

      public TimerTask scheduleWatchdogTick(Peer peer)
      Schedules a timer task tick to expire a watchdog timer (specified as timer "Tw" in RFC3539).
      Parameters:
      peer - the peer to inform about Tw tick
      Returns:
      null if timer is not available yet
    • setPeerRetryDelay

      public void setPeerRetryDelay(int secs)
      Sets the time to wait before attempting to reconnect to a failed peer.
      Parameters:
      secs - the peer retry delay in seconds
    • getPeerRetryDelay

      public int getPeerRetryDelay()
      Returns the time to wait for attempting to reconnect to a failed peer.
      Returns:
      the peer retry delay in seconds
    • setRequestTimeout

      public void setRequestTimeout(long msec)
      Sets the maximum time to wait for an answer to a request. If no answer is received within the given timeout period, then an UNABLE_TO_DELIVER error answer will generated and delivered to the application. (assuming that all retries have been exhausted). Note that retries are attempted after a timeout, so the total request duration is maxAttempts * timeout length.
      Parameters:
      msec - the request timeout in milliseconds
    • getRequestTimeout

      public long getRequestTimeout()
      Returns the maximum time to wait for an answer to a request.
      Returns:
      the request timeout in milliseconds
    • setMaxRequestAttempts

      public void setMaxRequestAttempts(int maximum)
      Sets the number of times to retry on failure.
      Parameters:
      maximum - the number of times to attempt to send a request.
    • getMaxRequestAttempts

      public int getMaxRequestAttempts()
      Returns the maximum number of times to retry a send.
      Returns:
      the max retries value
    • setWatchdogTimeout

      public void setWatchdogTimeout(int secs)
      Sets the watchdog timeout Tw.
      Parameters:
      secs - watchdog timeout Tw
    • getWatchdogTimeout

      public int getWatchdogTimeout()
      Returns:
      the value of Tw in seconds
    • stop

      public void stop()
      Stops all peers.
    • setAllowDynamicPeers

      public void setAllowDynamicPeers(boolean status)
    • isAllowDynamicPeers

      public boolean isAllowDynamicPeers()