Class NetworkHealthCheck
- java.lang.Object
-
- org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent
-
- org.apache.activemq.artemis.core.server.NetworkHealthCheck
-
- All Implemented Interfaces:
Runnable,ActiveMQComponent
public class NetworkHealthCheck extends ActiveMQScheduledComponent
This will useInetAddress.isReachable(int)to determine if the network is alive. It will have a set of addresses, and if any address is reached the network will be considered alive.
-
-
Field Summary
Fields Modifier and Type Field Description static StringIPV4_DEFAULT_COMMANDstatic StringIPV6_DEFAULT_COMMAND-
Fields inherited from class org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent
executor, scheduledExecutorService
-
-
Constructor Summary
Constructors Constructor Description NetworkHealthCheck()NetworkHealthCheck(String nicName, long checkPeriod, int networkTimeout)
-
Method Summary
-
Methods inherited from class org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent
delay, getInitialDelay, getPeriod, getTimeUnit, isStarted, setInitialDelay, setInitialDelayAndPeriod, setInitialDelayAndPeriod, setPeriod, start, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
-
-
-
Constructor Detail
-
NetworkHealthCheck
public NetworkHealthCheck()
-
NetworkHealthCheck
public NetworkHealthCheck(String nicName, long checkPeriod, int networkTimeout)
-
-
Method Detail
-
setNICName
public NetworkHealthCheck setNICName(String nicName)
-
isIgnoreLoopback
public boolean isIgnoreLoopback()
-
setIgnoreLoopback
public NetworkHealthCheck setIgnoreLoopback(boolean ignoreLoopback)
-
getNICName
public String getNICName()
-
parseAddressList
public NetworkHealthCheck parseAddressList(String addressList)
-
parseURIList
public NetworkHealthCheck parseURIList(String addressList)
-
getThreadFactory
protected ActiveMQThreadFactory getThreadFactory()
- Overrides:
getThreadFactoryin classActiveMQScheduledComponent
-
getNetworkTimeout
public int getNetworkTimeout()
-
setPeriod
public NetworkHealthCheck setPeriod(long period)
- Overrides:
setPeriodin classActiveMQScheduledComponent
-
setTimeUnit
public NetworkHealthCheck setTimeUnit(TimeUnit timeUnit)
- Overrides:
setTimeUnitin classActiveMQScheduledComponent
-
setNetworkTimeout
public NetworkHealthCheck setNetworkTimeout(int networkTimeout)
-
addComponent
public NetworkHealthCheck addComponent(ActiveMQComponent component)
-
clearComponents
public NetworkHealthCheck clearComponents()
-
addAddress
public NetworkHealthCheck addAddress(String straddress)
-
removeAddress
public NetworkHealthCheck removeAddress(String straddress)
-
clearAddresses
public NetworkHealthCheck clearAddresses()
-
addURL
public NetworkHealthCheck addURL(URL url)
-
removeURL
public NetworkHealthCheck removeURL(URL url)
-
clearURL
public NetworkHealthCheck clearURL()
-
getIpv4Command
public String getIpv4Command()
-
setIpv4Command
public NetworkHealthCheck setIpv4Command(String ipv4Command)
-
getIpv6Command
public String getIpv6Command()
-
setIpv6Command
public NetworkHealthCheck setIpv6Command(String ipv6Command)
-
run
public void run()
-
check
public boolean check()
- Returns:
- true if no checks were done or if one address/url responds; false if all addresses/urls fail
-
check
public boolean check(String straddress)
-
check
public boolean check(InetAddress address) throws IOException, InterruptedException
- Throws:
IOExceptionInterruptedException
-
isReachable
protected boolean isReachable(InetAddress address) throws IOException
- Throws:
IOException
-
purePing
public boolean purePing(InetAddress address) throws IOException, InterruptedException
- Throws:
IOExceptionInterruptedException
-
check
public boolean check(URL url)
-
isEmpty
public boolean isEmpty()
-
hasCustomPingCommand
public boolean hasCustomPingCommand()
-
-