public interface NetworkStatus extends AVList
logUnavailableHost(java.net.URL)
method when an attempt to contact a host
fails. Each invocation increments the failure count by one. When the count exceeds the attempt limit, the host is
marked as unreachable. When attempts to contact the host are successful, users should invoke logAvailableHost(java.net.URL)
method to clear its status.
A host may become reachable at a time subsequent to its being logged. To detect this, the implementation marks a host
as not unreachable after a specifiable interval of time. If the host is once more logged as unavailable, its entry
returns to the unavailable state. This cycle continues indefinitely.
Methods are provided to determine whether the public network can be reached and whether the NASA WorldWind servers
cab be reached. The addresses used to detect public network access can be explicitly specified.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
HOST_AVAILABLE |
static java.lang.String |
HOST_UNAVAILABLE |
Modifier and Type | Method and Description |
---|---|
int |
getAttemptLimit()
Returns the number of times a host must be logged as unavailable before it is marked unavailable in this class.
|
java.util.List<java.lang.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.
|
boolean |
isHostUnavailable(java.net.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 WorldWind will attempt to connect to the network to retrieve data or for other reasons.
|
boolean |
isWorldWindServerUnavailable()
Indicates whether the NASA WorldWind servers can be reached.
|
void |
logAvailableHost(java.net.URL url)
Log a host as available.
|
void |
logUnavailableHost(java.net.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(java.util.List<java.lang.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 WorldWind 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.
|
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
static final java.lang.String HOST_AVAILABLE
static final java.lang.String HOST_UNAVAILABLE
int getAttemptLimit()
java.util.List<java.lang.String> getNetworkTestSites()
long getTryAgainInterval()
boolean isHostUnavailable(java.net.URL url)
url
- a url containing the host to check for availability.boolean isNetworkUnavailable()
boolean isNetworkUnavailable(long checkInterval)
checkInterval
- the number of milliseconds in the past used to determine whether the server was avaialble
recently.boolean isOfflineMode()
true
if WorldWind is in off-line mode, false
if not.boolean isWorldWindServerUnavailable()
void logAvailableHost(java.net.URL url)
url
- a url containing the host to mark as available.void logUnavailableHost(java.net.URL url)
url
- a url containing the host to mark as unavailable.void setAttemptLimit(int limit)
limit
- the number of log-unavailability invocations necessary to consider the host unreachable.java.lang.IllegalArgumentException
- if the limit is less than 1.void setNetworkTestSites(java.util.List<java.lang.String> networkTestSites)
networkTestSites
- 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.void setOfflineMode(boolean offlineMode)
false
, indicating that the network should be used.offlineMode
- true
if WorldWind should use the network, false
otherwisevoid setTryAgainInterval(long interval)
interval
- The length of time, in milliseconds, to wait to unmark a host as unreachable.java.lang.IllegalArgumentException
- if the interval is less than 0.