pandeysambhi commented on issue #8382:
URL: https://github.com/apache/gravitino/issues/8382#issuecomment-3261483520

   @justinmclean 
   NPE was happening as scheduledExecutorService is initialized in the init() 
method, but only if clientPoolCache is null.
   clientPoolCache is a static field, meaning it is shared across all instances 
of IcebergHiveCachedClientPool.
   Only the first instance that calls init() will initialize both 
clientPoolCache and scheduledExecutorService.
   Any subsequent instances will find clientPoolCache already initialized, so 
they will not initialize scheduledExecutorService (it remains null for those 
instances).When we create multiple instances of IcebergHiveCachedClientPool, 
only the first instance will have a non-null scheduledExecutorService.The other 
instances will have scheduledExecutorService as null.
   When we call close() on all instances, each will attempt to call 
scheduledExecutorService.shutdownNow()
   For instances where scheduledExecutorService is null, this results in a 
NullPointerException.
   
   I am trying to get more in depth understanding of the project, from what I 
understood, we can either make scheduledExecutorService as static so that its 
shared or add a null check before closing it so that only the instance that 
actually initialized the executor tries to shut it down. I have opened a PR 
with null check. Just wanted to outline my understanding and reasoning here.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to