Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

datastore is not closing always #20

Open
@pbrizuela02

Description

@pbrizuela02

Hi Team, there is an issue with current code version. I am trying to close datastore from an app context destroy and current close method is not working properly.
The class ScheduledExecutorService is used and the datastore close method is trying to close it with this line: executor.shutdown();
However, it is not working and as there is a non-deamon thread alive the jvm process cannot finish. In my case, my webapp does not stop when I stop tomcat. So tomcat does not stop neither. Eventually, I have to kill jvm process to shutdown.

The fix may be to close it in this way:
try{
executor.shutdown();
if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
}catch(InterruptedException ie){
executor.shutdownNow();
Thread.currentThread().interrupt();
}

Above code worked in my case. You can double check how to close it from this java doc:
ExecutorService

Kind regards,
Pablo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions