public class IP2LocationBootstrap extends Object
Call initialize(int) during server startup (from ClientSessionManager or wherever services are loaded), and shutdown() during server shutdown. On server reload/restart, call initialize(int) again — the manager handles reconfiguration automatically if already configured.
NetPhantom supports running multiple server instances ("clustered mode") in separate JVM processes managed by a Cluster Controller. Each clustered instance is identified by a one-based index. The index parameter controls the operating mode:
index=0 — Normal (unclustered) server. Uses the configured database path as-is (e.g. IP2Location/).index≥1 — Clustered server instance. Appends "#" + index to the database path (e.g. IP2Location#1/, IP2Location#2/), following the standard NetPhantom convention for per-instance paths.Each JVM gets its own database directory to avoid:
MappedByteBuffer cannot be explicitly unmapped, preventing file replacement while any JVM holds a mapping..ip2location-state.properties file tracks download progress per instance.All cluster instances share the same [IP2Location] configuration in server.ini. Only the database path is modified per instance. Configuration changes should be made via the first cluster server's Admin UI (index=1), after which the Cluster Controller restarts the other instances to pick up the change.
The cluster index is stored in IP2LocationManager and is accessible via IP2LocationManager.getClusterIndex(), allowing the UI layer to restrict configuration editing on non-primary cluster instances.
| Constructor and Description |
|---|
IP2LocationBootstrap() |
| Modifier and Type | Method and Description |
|---|---|
static void | initialize(int index)Initializes the IP2Location service from server.ini settings. |
static void | shutdown()Shuts down the IP2Location service. |
public static void initialize(int index)
Safe to call multiple times: if the manager is already configured, this delegates to reconfigure (hot-swap). If [IP2Location] section is missing or enabled=0, the service starts in disabled mode.
Ordering requirement: this method must not proceed until the NetPhantom EventManager is running, because IP2Location logs every operation through EventManager.logEvent(int) and events queued before the EventManager thread exists are silently dropped. The boot is therefore gated: if ClientSessionManager.isEventManagerActive() is false the call is refused and returns without configuring the manager. The sanctioned caller is ClientSessionManager.bootIP2Location(), which performs the same check; this guard is the second line of defence for any other call path.
index - Index value of this cluster server instance if larger than zero, i.e. 1=first cluster server, etc. If the server is a normal unclustered server, the index value is 0.public static void shutdown()
Call during server shutdown. Safe to call if not initialized.
Phantom® and NetPhantom® are registered trademarks of Mindus SARL.
© 2026 Mindus SARL. All rights reserved.