Class IP2LocationSettings
java.lang.Object
com.iizix.server.geo.ip2location.IP2LocationSettings
Assembles the IP2Location service configuration from the server settings: the database directory, the
IP2LocationService.Builder and the RecoveryConfig. The values themselves are read through the typed, range-checked getters of ServerSettings; this class only turns them into the objects the co.mindus.ip2location library takes, so that the library stays free of any server type.- Author:
- Christopher Mindus
Field Summary
FieldsMethod Summary
Modifier and TypeMethodDescriptionstatic IP2LocationService.BuildercreateBuilder(ServerSettings settings, Path directory, IEventLogger logger) Creates the service builder from the settings.static RecoveryConfigcreateRecoveryConfig(ServerSettings settings) Creates the recovery configuration from the settings.static PathresolveDatabaseDirectory(ServerSettings settings, File currentDirectory, int clusterIndex) Resolves the database directory.static IThreadFactoryGets the thread factory of the service: the threads come from IIZI's system thread group (VirtualThreadGroup.getSystemVirtualThreadGroup(), ruled 2026-09-12, Q9 of CC-GEO-IP2LOCATION), so that they carry the server's loggers and its uncaught-exception handler like every other server thread.
Field Details
NO_TOKEN
The token handed to the library when none is configured: the builder refuses an empty token even for a disabled service, and a disabled service never downloads. NetPhantom's bootstrap does the same (token.isEmpty() ? "NONE" : token).- See Also:
Method Details
threadFactory
Gets the thread factory of the service: the threads come from IIZI's system thread group (VirtualThreadGroup.getSystemVirtualThreadGroup(), ruled 2026-09-12, Q9 of CC-GEO-IP2LOCATION), so that they carry the server's loggers and its uncaught-exception handler like every other server thread. The name the library asks for is applied; the daemon flag is not, the group decides it (its threads are platform threads today, which the library's ownIThreadFactory.virtualFactory()would not be).- Returns:
- The thread factory.
resolveDatabaseDirectory
public static Path resolveDatabaseDirectory(ServerSettings settings, File currentDirectory, int clusterIndex) Resolves the database directory. A relativeServerSettings.getIP2LocationDatabasePath()is taken relative to the server's current directory. A clustered instance (index at least 1) gets its own directory by the suffix"#"+index, so that two JVMs never replace each other's memory-mapped files; index 0 uses the path as configured.- Parameters:
settings- The server settings.currentDirectory- The server's current directory.clusterIndex- The cluster index, 0 for an unclustered server.- Returns:
- The absolute database directory.
createBuilder
public static IP2LocationService.Builder createBuilder(ServerSettings settings, Path directory, IEventLogger logger) Creates the service builder from the settings.- Parameters:
settings- The server settings.directory- The resolved database directory, seeresolveDatabaseDirectory(ServerSettings, File, int).logger- The event logger to install.- Returns:
- The builder, enabled according to the settings and carrying the token (
NO_TOKENwhen none is configured, so that a disabled service can be built), with the threads ofthreadFactory().
createRecoveryConfig
Creates the recovery configuration from the settings.- Parameters:
settings- The server settings.- Returns:
- The recovery configuration.