Class IP2LocationModule

java.lang.Object
com.iizix.server.geo.ip2location.IP2LocationModule
All Implemented Interfaces:
IServerModule<Object>

public class IP2LocationModule extends Object implements IServerModule<Object>
The IP geolocation server module: the IIZI bootstrap of the co.mindus.ip2location library. Added by ServerShell.onWorkerStarted right after the Push Notification module, which reaches initialize(IServer) through ServerShell.addModule.

What the switches do.

  • ServerSettings.IP2LOCATION_ENABLED (default off): initialize(IServer) configures the IP2LocationManager asynchronously from the settings - the database directory, the LITE database tier, IPv4 or IPv4+IPv6, memory mapping, the recovery configuration, the download token - so the server starts without waiting for a download. onServerReady(IServer) then registers the region location providers with IP2Location first, which makes it the default provider of RegionLocationService; lookups stay on the server. Without the switch nothing of this happens, exactly as before this module existed: no provider is registered in production.
  • ServerSettings.GEO_WEB_PROVIDERS (default off): the web providers GeoPlugin, IPStack and IPWhoIs are registered too (after IP2Location when that is enabled); a lookup through one of them sends the client's IP address to that web service.
  • ServerSettings.GEO_SESSION_LOG (default off): SessionGeoLogger writes the geolocation of every client session at connect, reconnect and disconnect, using whichever provider is the default. It is read at every event, not here.

The module exposes no WebSocket end point. dispose() shuts the manager down; the providers are disposed of by ServerShell.dispose through RegionLocationService.shutdown(), which only that class may call.

Cluster index. IIZI has no per-instance identity for clustered servers (nothing in com.iizix.server.loadbalancer numbers the members), so the index is always 0 and the database directory is the configured path as is.

Author:
Christopher Mindus
  • Field Details

    • CLUSTER_INDEX

      public static final int CLUSTER_INDEX
      The cluster index of this server instance: IIZI has none, so 0 (unclustered).
      See Also:
  • Constructor Details

    • IP2LocationModule

      public IP2LocationModule()
  • Method Details