NASA World Wind

gov.nasa.worldwind.util
Class NetworkCheckThread

java.lang.Object
  extended by java.lang.Thread
      extended by gov.nasa.worldwind.util.NetworkCheckThread
All Implemented Interfaces:
Runnable

public class NetworkCheckThread
extends Thread

Periodically checks network availability.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected static long DEFAULT_NET_CHECK_INTERVAL
           
protected  AtomicBoolean isNetAvailable
           
protected  AtomicLong netChecInterval
           
protected  AtomicBoolean showNetStatus
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NetworkCheckThread(AtomicBoolean showNetStatus, AtomicBoolean isNetAvailable, Long interval)
          Constructs a new instance of this class.
 
Method Summary
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NET_CHECK_INTERVAL

protected static final long DEFAULT_NET_CHECK_INTERVAL
See Also:
Constant Field Values

isNetAvailable

protected AtomicBoolean isNetAvailable

netChecInterval

protected AtomicLong netChecInterval

showNetStatus

protected AtomicBoolean showNetStatus
Constructor Detail

NetworkCheckThread

public NetworkCheckThread(AtomicBoolean showNetStatus,
                          AtomicBoolean isNetAvailable,
                          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 value false.

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.
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

NASA World Wind