@@ -146,8 +146,12 @@ public final class DatabaseNodeService implements IpDatabaseProvider {
146146 this .clusterService = clusterService ;
147147 }
148148
149- public void initialize (String nodeId , ResourceWatcherService resourceWatcher , IngestService ingestServiceArg ,
150- ProjectResolver projectResolver ) throws IOException {
149+ public void initialize (
150+ String nodeId ,
151+ ResourceWatcherService resourceWatcher ,
152+ IngestService ingestServiceArg ,
153+ ProjectResolver projectResolver
154+ ) throws IOException {
151155 configDatabases .initialize (resourceWatcher );
152156 geoipTmpDirectory = geoipTmpBaseDirectory .resolve (nodeId );
153157 // delete all stale files in the geoip tmp directory
@@ -191,7 +195,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) {
191195 }
192196
193197 @ Override
194- public Boolean isValid (ProjectId projectId ,String databaseFile ) {
198+ public Boolean isValid (ProjectId projectId , String databaseFile ) {
195199 ProjectState projectState = clusterService .state ().projectState (projectId );
196200 assert projectState != null ;
197201
@@ -253,9 +257,11 @@ DatabaseReaderLazyLoader get(ProjectId projectId, String key) {
253257 public void shutdown () throws IOException {
254258 // this is a little 'fun' looking, but it's just adapting IOUtils.close() into something
255259 // that can call a bunch of shutdown methods (rather than close methods)
256- final var loadersToShutdown = databases .values ().stream ()
260+ final var loadersToShutdown = databases .values ()
261+ .stream ()
257262 .flatMap (map -> map .values ().stream ())
258- .map (ShutdownCloseable ::new ).toList ();
263+ .map (ShutdownCloseable ::new )
264+ .toList ();
259265 databases .clear ();
260266 IOUtils .close (loadersToShutdown );
261267 }
@@ -285,7 +291,8 @@ void checkDatabases(ClusterState state) {
285291 for (ProjectMetadata projectMetadata : state .getMetadata ().projects ().values ()) {
286292 ProjectId projectId = projectMetadata .id ();
287293
288- PersistentTasksCustomMetadata persistentTasks = state .metadata ().getProject (projectId )
294+ PersistentTasksCustomMetadata persistentTasks = state .metadata ()
295+ .getProject (projectId )
289296 .custom (PersistentTasksCustomMetadata .TYPE );
290297 if (persistentTasks == null ) {
291298 logger .trace ("Not checking databases for project [{}] because persistent tasks are null" , projectId );
@@ -301,8 +308,11 @@ void checkDatabases(ClusterState state) {
301308 Index databasesIndex = databasesAbstraction .getWriteIndex ();
302309 IndexRoutingTable databasesIndexRT = state .routingTable (projectId ).index (databasesIndex );
303310 if (databasesIndexRT == null || databasesIndexRT .allPrimaryShardsActive () == false ) {
304- logger .trace ("Not checking databases because geoip databases index does not have all active primary shards for" +
305- " project [{}]" , projectId );
311+ logger .trace (
312+ "Not checking databases because geoip databases index does not have all active primary shards for"
313+ + " project [{}]" ,
314+ projectId
315+ );
306316 return ;
307317 }
308318 }
@@ -312,8 +322,10 @@ void checkDatabases(ClusterState state) {
312322
313323 // process the geoip task state for the (ordinary) geoip downloader
314324 {
315- GeoIpTaskState taskState = getGeoIpTaskState (projectMetadata , getTaskId (projectId ,
316- projectResolver .supportsMultipleProjects ()));
325+ GeoIpTaskState taskState = getGeoIpTaskState (
326+ projectMetadata ,
327+ getTaskId (projectId , projectResolver .supportsMultipleProjects ())
328+ );
317329 if (taskState == null ) {
318330 // Note: an empty state will purge stale entries in databases map
319331 taskState = GeoIpTaskState .EMPTY ;
@@ -439,8 +451,11 @@ void retrieveAndUpdateDatabase(ProjectId projectId, String databaseName, GeoIpTa
439451 if (name .startsWith (databaseName )) {
440452 Files .copy (is , databaseTmpFile , StandardCopyOption .REPLACE_EXISTING );
441453 } else {
442- Files .copy (is , databaseTmpDirectory .resolve (databaseName + "_" + name ),
443- StandardCopyOption .REPLACE_EXISTING );
454+ Files .copy (
455+ is ,
456+ databaseTmpDirectory .resolve (databaseName + "_" + name ),
457+ StandardCopyOption .REPLACE_EXISTING
458+ );
444459 }
445460 }
446461 }
@@ -466,7 +481,8 @@ void retrieveAndUpdateDatabase(ProjectId projectId, String databaseName, GeoIpTa
466481 ioe .addSuppressed (failure );
467482 logger .error ("unable to delete tmp database file after failure" , ioe );
468483 }
469- });
484+ }
485+ );
470486 }
471487
472488 void updateDatabase (ProjectId projectId , String databaseFileName , String recordedMd5 , Path file ) {
@@ -522,7 +538,7 @@ void removeStaleEntries(ProjectId projectId, Collection<String> staleEntries) {
522538 assert existing != null ;
523539 existing .shutdown (true );
524540 } catch (Exception e ) {
525- logger .error (() -> "failed to clean database [" + staleEntry + "] for project [" + projectId + "]" , e );
541+ logger .error (() -> "failed to clean database [" + staleEntry + "] for project [" + projectId + "]" , e );
526542 }
527543 }
528544 }
@@ -558,7 +574,7 @@ void retrieveDatabase(
558574 // so it is ok if this happens in a blocking manner on a thread from generic thread pool.
559575 // This makes the code easier to understand and maintain.
560576 // TODO: we should revisit if blocking the generic thread pool for search is still acceptable,
561- // since in multi-project mode each project will have its own geoip databases index search
577+ // since in multi-project mode each project will have its own geoip databases index search
562578 SearchResponse searchResponse = client .search (searchRequest ).actionGet ();
563579 try {
564580 SearchHit [] hits = searchResponse .getHits ().getHits ();
0 commit comments