mickleness / pumpernickel

This Java project includes classes related to desktop applications, Swing, performance, image processing, data structures, and other misc topics.
https://mickleness.github.io/pumpernickel/
MIT License
66 stars 12 forks source link

Cache: shut down timer when inactive #57

Open mickleness opened 4 years ago

mickleness commented 4 years ago

There is a static Timer used to purge CachePools.

Once it is activated it keeps a thread running forever.

Instead: we shut down the timer when it is empty, or when the CachePool it relates to is empty. (Which means we have to restart it appropriately, too.)

Also we can try using an ExecutorService instead of a Timer.