485064 HashSessionManager leaks ScheduledExecutorScheduler with reference to un-deployed webapp
This commit is contained in:
parent
f519aa28fb
commit
913ef1a39a
|
@ -184,6 +184,11 @@ public class HashSessionManager extends AbstractSessionManager
|
||||||
_task.cancel();
|
_task.cancel();
|
||||||
|
|
||||||
_task=null;
|
_task=null;
|
||||||
|
|
||||||
|
//if we're managing our own timer, remove it
|
||||||
|
if (isManaged(_timer))
|
||||||
|
removeBean(_timer);
|
||||||
|
|
||||||
_timer=null;
|
_timer=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +197,6 @@ public class HashSessionManager extends AbstractSessionManager
|
||||||
super.doStop();
|
super.doStop();
|
||||||
|
|
||||||
_sessions.clear();
|
_sessions.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.jetty.server.Server;
|
||||||
import org.eclipse.jetty.toolchain.test.FS;
|
import org.eclipse.jetty.toolchain.test.FS;
|
||||||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
||||||
import org.eclipse.jetty.util.IO;
|
import org.eclipse.jetty.util.IO;
|
||||||
|
import org.eclipse.jetty.util.thread.Scheduler;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -80,7 +81,25 @@ public class HashSessionManagerTest
|
||||||
Server server = new Server();
|
Server server = new Server();
|
||||||
SessionHandler handler = new SessionHandler();
|
SessionHandler handler = new SessionHandler();
|
||||||
handler.setServer(server);
|
handler.setServer(server);
|
||||||
HashSessionManager manager = new HashSessionManager();
|
HashSessionManager manager = new HashSessionManager()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void doStart() throws Exception
|
||||||
|
{
|
||||||
|
super.doStart();
|
||||||
|
Scheduler timerBean = getBean(Scheduler.class);
|
||||||
|
Assert.assertNotNull(timerBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doStop() throws Exception
|
||||||
|
{
|
||||||
|
super.doStop();
|
||||||
|
Scheduler timerBean = getBean(Scheduler.class);
|
||||||
|
Assert.assertNull(timerBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
manager.setStoreDirectory(testDir);
|
manager.setStoreDirectory(testDir);
|
||||||
manager.setMaxInactiveInterval(5);
|
manager.setMaxInactiveInterval(5);
|
||||||
Assert.assertTrue(testDir.exists());
|
Assert.assertTrue(testDir.exists());
|
||||||
|
|
Loading…
Reference in New Issue