Package com.bea.wcp.diameter
Class PeerTable
java.lang.Object
com.bea.wcp.diameter.PeerTable
The peer table manages information about configured Diameter peers.
- Author:
- Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intDefault connection retry in second.sstatic final longDefault request timeout in milliseconds.static final intDefault watchdog timeout in seconds.static final intWatchdog period in milliiseconds. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddPeer(String host, InetAddress addr, int port) voidaddPeerIpAddressToHostIdMapping(Peer peer, String host) intReturns the maximum number of times to retry a send.getPeerByAddress(InetAddress address) intReturns the time to wait for attempting to reconnect to a failed peer.getPeerWithoutCreation(String host) longReturns the maximum time to wait for an answer to a request.intbooleanLists all known peer host names.voidscheduleReconnect(Peer peer) Schedules a timer task to reconnect to a peer after a configured peerRetryDelay (specified as timer "Tc" in RFC3588).scheduleWatchdogTick(Peer peer) Schedules a timer task tick to expire a watchdog timer (specified as timer "Tw" in RFC3539).voidsetAllowDynamicPeers(boolean status) voidsetMaxRequestAttempts(int maximum) Sets the number of times to retry on failure.voidsetPeerRetryDelay(int secs) Sets the time to wait before attempting to reconnect to a failed peer.voidsetRequestTimeout(long msec) Sets the maximum time to wait for an answer to a request.voidsetWatchdogTimeout(int secs) Sets the watchdog timeout Tw.voidstart()voidstop()Stops all peers.
-
Field Details
-
DEFAULT_PEER_RETRY_DELAY
public static final int DEFAULT_PEER_RETRY_DELAYDefault connection retry in second.s- See Also:
-
DEFAULT_REQUEST_TIMEOUT
public static final long DEFAULT_REQUEST_TIMEOUTDefault 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_TIMEOUTDefault watchdog timeout in seconds.- See Also:
-
WATCHDOG_TICK_RESOLUTION
public static final int WATCHDOG_TICK_RESOLUTIONWatchdog period in milliiseconds.- See Also:
-
-
Method Details
-
getPeer
-
getPeerByAddress
-
getPeerWithoutCreation
-
addPeer
-
addPeerIpAddressToHostIdMapping
-
addPeer
-
listPeers
Lists all known peer host names.- Returns:
- Hostname of all peers
-
start
public void start() -
scheduleReconnect
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
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()
-