From: Jan S. <st...@us...> - 2002-01-27 23:09:11
|
Update of /cvsroot/javaprofiler/module/net/sourceforge/javaprofiler/module/nodes In directory usw-pr-cvs1:/tmp/cvs-serv5911 Added Files: SessionKiller.java Log Message: Thread that removes disconnected/shutdowned sessions from memory. --- NEW FILE: SessionKiller.java --- /* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License Version * 1.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is available at http://www.sun.com/ * * The Original Code is the Java Profiler module. * The Initial Developers of the Original Code are Jan Stola, Pavel Vacha, * Michal Pise, Petr Luner, Lukas Petru and Marek Przeczek. * Portions created by Jan Stola are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Pavel Vacha are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Michal Pise are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Petr Luner are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Lukas Petru are Copyright (C) 2000-2001. All Rights Reserved. * Portions created by Marek Przeczek are Copyright (C) 2000-2001. All Rights Reserved. * * Contributors: Jan Stola, Pavel Vacha, Michal Pise, Petr Luner, * Lukas Petru and Marek Przeczek. */ package net.sourceforge.javaprofiler.module.nodes; import java.util.*; import net.sourceforge.javaprofiler.jpi.VMDisconnectedException; import net.sourceforge.javaprofiler.module.data.Session; import net.sourceforge.javaprofiler.module.data.ProfilerData; /** * Kills session nodes when corresponding sessions are finished. * * @author Jan Stola */ public class SessionKiller extends Thread { public SessionKiller() { } public void run() { try { while (true) { List sessions=ProfilerData.getData().sessions(); Iterator iter=sessions.iterator(); Session session; while (iter.hasNext()) { session=(Session)iter.next(); try { if (session.getVM().isShutdowned()) { session.getVM().shutdown(); ProfilerData.getData().removeSession(session); } } catch (VMDisconnectedException e) { // session disconnected, should be removed from memory ProfilerData.getData().removeSession(session); } } Thread.sleep(2000); } } catch (InterruptedException e) { // terminate the while loop when the thread is interrupted } } } /* * $Log: SessionKiller.java,v $ * Revision 1.1 2002/01/27 23:09:09 stolis * Thread that removes disconnected/shutdowned sessions from memory. * */ |