Package gov.nasa.worldwind.util
Class NetworkCheckThread
- java.lang.Object
-
- java.lang.Thread
-
- gov.nasa.worldwind.util.NetworkCheckThread
-
- All Implemented Interfaces:
java.lang.Runnable
public class NetworkCheckThread extends java.lang.Thread
Periodically checks network availability.
-
-
Field Summary
Fields Modifier and Type Field Description protected static long
DEFAULT_NET_CHECK_INTERVAL
protected java.util.concurrent.atomic.AtomicBoolean
isNetAvailable
protected java.util.concurrent.atomic.AtomicLong
netChecInterval
protected java.util.concurrent.atomic.AtomicBoolean
showNetStatus
-
Constructor Summary
Constructors Constructor Description NetworkCheckThread(java.util.concurrent.atomic.AtomicBoolean showNetStatus, java.util.concurrent.atomic.AtomicBoolean isNetAvailable, java.lang.Long interval)
Constructs a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
run()
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, toString, yield
-
-
-
-
Field Detail
-
DEFAULT_NET_CHECK_INTERVAL
protected static final long DEFAULT_NET_CHECK_INTERVAL
- See Also:
- Constant Field Values
-
showNetStatus
protected java.util.concurrent.atomic.AtomicBoolean showNetStatus
-
isNetAvailable
protected java.util.concurrent.atomic.AtomicBoolean isNetAvailable
-
netChecInterval
protected java.util.concurrent.atomic.AtomicLong netChecInterval
-
-
Constructor Detail
-
NetworkCheckThread
public NetworkCheckThread(java.util.concurrent.atomic.AtomicBoolean showNetStatus, java.util.concurrent.atomic.AtomicBoolean isNetAvailable, java.lang.Long interval)
Constructs a new instance of this class. Once started, the thread checks network availability at a specified frequency and stores the result in an atomic variable specified to the constructor. The thread terminates when it's interrupted or when a specified boolean atomic variable has the valuefalse
.- Parameters:
showNetStatus
- a reference to an atomic variable indicating whether the thread should continue running. This variable is tested prior to each network check. The thread terminates when it becomes false.isNetAvailable
- a reference to an atomic variable in which to write the status of the network check.interval
- the interval at which to perform the network check, or null if the default interval of one second is to be used.
-
-