CacheListener close method not called when cache closes before region initialization completes in VMware GemFire
search cancel

CacheListener close method not called when cache closes before region initialization completes in VMware GemFire

book

Article ID: 294024

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

This issue applies to all currently released VMware GemFire and VMware Tanzu GemFire products. 

Currently the CacheListeners init methods are called before regions are created, but their close method is called only after regions are destroyed. This means that resources allocated during init, such as threads or executors, may not be cleaned up if the cache is closed prior to the region being completely initialized – such as by a disk-store exception. This article is about a specific instance of this issue and how to resolve it. 

If the init method creates non-daemon threads, which are not cleaned up by the listener's close method, it prevents the JVM from exiting. This article is about a specific instance of this issue and how to resolve it. 


Resolution

As a workaround until a fix is available, you might consider making these threads daemon threads. Here is a link to one approach on how to do this: http://javaresolutions.blogspot.com/2013/05/how-to-make-executor-as-daemon-thread.html

Note: This issue will be addressed through the internal product issue GEM-2826.