From 70725f236baf76e1b8ddaad87af30fed741769b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jason=20Jij=C3=B3n?= Date: Tue, 9 Oct 2018 14:40:57 -0500 Subject: [PATCH] Fix #11 - jTDS Memory Leak on WildFly 10.1 related to TimerThread --- src/main/net/sourceforge/jtds/util/TimerThread.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/net/sourceforge/jtds/util/TimerThread.java b/src/main/net/sourceforge/jtds/util/TimerThread.java index e7ea933d..472cc99b 100644 --- a/src/main/net/sourceforge/jtds/util/TimerThread.java +++ b/src/main/net/sourceforge/jtds/util/TimerThread.java @@ -97,6 +97,10 @@ public static synchronized TimerThread getInstance() { public TimerThread() { // Set the thread name super("jTDS TimerThread"); + // Set contextClassLoader to library ClassLoader if possible + try { + this.setContextClassLoader(this.getClass().getClassLoader()); + } catch (SecurityException e) { } // Ensure that this thread does not prevent the VM from exiting this.setDaemon(true); }