spfrommer / JCommunique

A desktop notification library written in pure Java.
MIT License
29 stars 10 forks source link

NotificationManager leaves hanging timer threads #9

Open erieflin opened 6 years ago

erieflin commented 6 years ago

When creating a notification via plain.addNotification(notification, Time.seconds(2));

A timer thread is created and never cleaned up (likely RemoveTimer at notificationManager line 64)

After the notification closes the thread remains running in memory until application termination, causing resource leak and preventing application close without system.exit().

This is easily visible debugging the demo app code in eclipse and watching the threads created.

This problem can be worked around by the following code block

        plain.addNotification(notification, Time.infinite());
    Thread.sleep(2000);
    plain.removeNotification(notification);

Resulting in no lingering thread and system terminating properly upon successful completion.

I will use this work around for my personal uses, I am creating this issue to document the workaround and the problem.

benchdoos commented 5 years ago

Will be fixed?

s0c1aleng1n commented 5 years ago

or simple System.exit(0);