mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 18:48:00 +01:00
Improve logging of finalize() methods
This commit is contained in:
parent
18ac83cf8c
commit
efb9a5f517
2 changed files with 7 additions and 1 deletions
|
@ -1057,6 +1057,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
|
LOGGER.fine("finalizing XMPPConnection ( " + getConnectionCounter()
|
||||||
|
+ "): Shutting down executor services");
|
||||||
try {
|
try {
|
||||||
// It's usually not a good idea to rely on finalize. But this is the easiest way to
|
// It's usually not a good idea to rely on finalize. But this is the easiest way to
|
||||||
// avoid the "Smack Listener Processor" leaking. The thread(s) of the executor have a
|
// avoid the "Smack Listener Processor" leaking. The thread(s) of the executor have a
|
||||||
|
|
|
@ -404,9 +404,13 @@ public class PingManager extends Manager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void finalize() throws Throwable {
|
protected void finalize() throws Throwable {
|
||||||
|
LOGGER.fine("finalizing PingManager: Shutting down executor service");
|
||||||
try {
|
try {
|
||||||
executorService.shutdown();
|
executorService.shutdown();
|
||||||
} finally {
|
} catch (Throwable t) {
|
||||||
|
LOGGER.log(Level.WARNING, "finalize() threw throwable", t);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
super.finalize();
|
super.finalize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue