java - ThreadPoolExecutor clean up when a thread dies -


i have threadpoolexecutor runs few core , max number of threads. task run creates hornetq (standalone) connections each thread , keeps them alive while thread running. however, cannot close them when thread keepalivetime expires , thread dies. there way clean resources right before thread dies?

one way out of using pooling solution hornetq connections.

any suggestions highly appreciated.

if using jdk 1.7, embed stuff on closable interface, , closed out of scope. working on implementing on jms 2, meanwhile embed own class delegating stuff. have keep stuff referenced somewhere in thread go out of scope when thread gone. (thread local maybe?)

you need use try (statement=statement.open()) {} , auto closeable called


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -