Package com.iizix.server.region
Class IPStack
java.lang.Object
com.iizix.geo.RegionLocationService
com.iizix.server.region.IPStack
The "IPStack.com" service provider for region location information.
- Author:
- Christopher Mindus
Field Summary
Fields inherited from class com.iizix.geo.RegionLocationService
ENCODING, ENCODING_NAME
Constructor Summary
ConstructorDescriptionIPStack
(IWebServiceEngine wse, ServerSettings settings) Constructs the service provider for the region location information.Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Returns if the service provider is available to use.protected RegionLocation
Requests region location information from the service provider.Methods inherited from class com.iizix.geo.RegionLocationService
configure, createRegionLocation, createRegionLocation, createRegionLocation, getDefaultName, getInstance, getName, getNames, initialize, isDisposed, onDisposed, parse, setGlobalCacheSize, shutdown
Constructor Details
IPStack
Constructs the service provider for the region location information. The server will once constructed, register the service with its name. The name is "IPStack" and the default timeout is set to 20 seconds, but the site is really fast.- Parameters:
wse
- The WebService engine used to determine proxy.settings
- Server settings.
Method Details
isAvailable
protected boolean isAvailable()Returns if the service provider is available to use.Subclasses override this method to return another value than
true
.- Overrides:
isAvailable
in classRegionLocationService
- Returns:
- true for OK to use, false if not properly configured.
request
protected RegionLocation request(String ipAddress) throws IOException, InterruptedIOException, InterruptedException Requests region location information from the service provider. When the request has completed with or without error, call- Specified by:
request
in classRegionLocationService
- Parameters:
ipAddress
- The IP address request.- Returns:
- The region location information, must always be non-null.
- Throws:
IOException
- For I/O errors.InterruptedIOException
- If an I/O operation is interrupted.InterruptedException
- If thread is interrupted.