|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nasa.worldwind.avlist.AVListImpl
gov.nasa.worldwind.util.BasicNetworkStatus
public class BasicNetworkStatus
Basic implementation of NetworkStatus.
| Nested Class Summary | |
|---|---|
protected static class |
BasicNetworkStatus.HostInfo
|
| Field Summary | |
|---|---|
protected static int |
DEFAULT_ATTEMPT_LIMIT
|
protected static String[] |
DEFAULT_NETWORK_TEST_SITES
|
protected static long |
DEFAULT_TRY_AGAIN_INTERVAL
|
protected ConcurrentHashMap<String,BasicNetworkStatus.HostInfo> |
hostMap
|
protected AtomicLong |
lastAvailableLogTime
|
protected AtomicLong |
lastNetworkCheckTime
|
protected AtomicLong |
lastNetworkStatusReportTime
|
protected AtomicBoolean |
lastNetworkUnavailableResult
|
protected AtomicLong |
lastUnavailableLogTime
|
protected static long |
NETWORK_STATUS_REPORT_INTERVAL
|
| Fields inherited from interface gov.nasa.worldwind.util.NetworkStatus |
|---|
HOST_AVAILABLE, HOST_UNAVAILABLE |
| Constructor Summary | |
|---|---|
BasicNetworkStatus()
|
|
| Method Summary | |
|---|---|
protected void |
establishNetworkTestSites()
Determines and stores the network sites to test for public network connectivity. |
int |
getAttemptLimit()
Returns the number of times a host must be logged as unavailable before it is marked unavailable in this class. |
List<String> |
getNetworkTestSites()
Returns the server domain names of the sites used to test public network availability. |
long |
getTryAgainInterval()
Returns the length of time to wait until a host is marked as not unreachable subsequent to its being marked unreachable. |
protected static boolean |
isHostReachable(String hostName)
Determine if a host is reachable by attempting to resolve the host name, and then attempting to open a connection. |
boolean |
isHostUnavailable(URL url)
Indicates whether the host has been marked as unavailable. |
boolean |
isNetworkUnavailable()
Indicates whether a public network can be reached or has been reached in the previous five seconds. |
boolean |
isNetworkUnavailable(long checkInterval)
Indicates whether a public network can be reached or has been reached in a specified previous amount of time. |
boolean |
isOfflineMode()
Indicates whether World Wind will attempt to connect to the network to retrieve data or for other reasons. |
boolean |
isWorldWindServerUnavailable()
Indicates whether the NASA World Wind servers can be reached. |
void |
logAvailableHost(URL url)
Log a host as available. |
void |
logUnavailableHost(URL url)
Log a host as unavailable. |
void |
setAttemptLimit(int limit)
Sets the number of times a host must be logged as unavailable before it is marked unavailable in this class. |
void |
setNetworkTestSites(List<String> networkTestSites)
Sets the domain names, e.g., worldwind.arc.nasa.gov, of sites used to determine public network availability. |
void |
setOfflineMode(boolean offlineMode)
Indicates whether World Wind should attempt to connect to the network to retrieve data or for other reasons. |
void |
setTryAgainInterval(long interval)
Sets the length of time to wait until a host is marked as not unreachable subsequent to its being marked unreachable. |
| Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl |
|---|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface gov.nasa.worldwind.avlist.AVList |
|---|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues |
| Field Detail |
|---|
protected static final int DEFAULT_ATTEMPT_LIMIT
protected static final String[] DEFAULT_NETWORK_TEST_SITES
protected static final long DEFAULT_TRY_AGAIN_INTERVAL
protected ConcurrentHashMap<String,BasicNetworkStatus.HostInfo> hostMap
protected AtomicLong lastAvailableLogTime
protected AtomicLong lastNetworkCheckTime
protected AtomicLong lastNetworkStatusReportTime
protected AtomicBoolean lastNetworkUnavailableResult
protected AtomicLong lastUnavailableLogTime
protected static final long NETWORK_STATUS_REPORT_INTERVAL
| Constructor Detail |
|---|
public BasicNetworkStatus()
| Method Detail |
|---|
protected void establishNetworkTestSites()
AVKey.NETWORK_STATUS_TEST_SITES). If that
property is not defined, the sites are drawn from the same property in the World Wind or application
configuration file. If the sites are not specified there, the set of sites specified in DEFAULT_NETWORK_TEST_SITES are used. To indicate an empty list in the JVM property or configuration file
property, specify an empty site list, "".
public int getAttemptLimit()
getAttemptLimit in interface NetworkStatuspublic List<String> getNetworkTestSites()
getNetworkTestSites in interface NetworkStatuspublic long getTryAgainInterval()
getTryAgainInterval in interface NetworkStatusprotected static boolean isHostReachable(String hostName)
hostName - Name of the host to connect to.
true if a the host is reachable, false if the host name cannot be resolved, or if opening
a connection to the host fails.public boolean isHostUnavailable(URL url)
isHostUnavailable in interface NetworkStatusurl - a url containing the host to check for availability.
public boolean isNetworkUnavailable()
isNetworkUnavailable in interface NetworkStatuspublic boolean isNetworkUnavailable(long checkInterval)
isNetworkUnavailable in interface NetworkStatuscheckInterval - the number of milliseconds in the past used to determine whether the server was avaialble
recently.
public boolean isOfflineMode()
isOfflineMode in interface NetworkStatustrue if World Wind is in off-line mode, false if not.public boolean isWorldWindServerUnavailable()
isWorldWindServerUnavailable in interface NetworkStatuspublic void logAvailableHost(URL url)
logAvailableHost in interface NetworkStatusurl - a url containing the host to mark as available.public void logUnavailableHost(URL url)
logUnavailableHost in interface NetworkStatusurl - a url containing the host to mark as unavailable.public void setAttemptLimit(int limit)
setAttemptLimit in interface NetworkStatuslimit - the number of log-unavailability invocations necessary to consider the host unreachable.public void setNetworkTestSites(List<String> networkTestSites)
setNetworkTestSites in interface NetworkStatusnetworkTestSites - the list of desired test sites. The list is copied internally, so changes made to the
submitted list do not affect instances of this class. May be null, in which case no sites
are consulted.public void setOfflineMode(boolean offlineMode)
false, indicating that the network should be used.
setOfflineMode in interface NetworkStatusofflineMode - true if World Wind should use the network, false otherwisepublic void setTryAgainInterval(long interval)
setTryAgainInterval in interface NetworkStatusinterval - The length of time, in milliseconds, to wait to unmark a host as unreachable.
|
NASA World Wind | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||