From: Tim A. <tan...@bi...> - 2003-04-27 13:06:13
|
The Timer.reset() stops the current thread and starts a new one - not exactly optimal but sufficient for the purposes of the sample code. By invoking thread_.interrupt(), an InterruptedException will be caught in Runner.run() which will then return, terminating the thread associated with thread_. > -----Original Message----- > From: ope...@li... > [mailto:ope...@li...]On Behalf Of yugandhar > srinivas > Sent: Monday, 21 April 2003 8:11 AM > To: ope...@li... > Subject: [openjms-user] Timer class > > > Hi, > > I was looking through the source code of Timer class > in package openjms.examples.client.console. > > In that code, the void reset() code is not clear to > me. It basically calls stop() and start(). When you > call stop(), the thread_ process is woke up(by > thread_.interrupt) and slept again(by > Thread.currentThread().sleep(500) where > Thread.currentThread is now thread_). start() is now > called, which creates a new thread. > > Is it not a multiplication of so many number of > threads being created for every time, with old ones > not being freed? Consequently, eating up the stack > space. Am I missing something? I am not clear, what > point in the code, is the previous thread cleared? > > Probably this is a java question to be mailed to java > user groups but hope someone could advise me in this > mailing list, as they have the open source code. > > Thanks > Srinivas > > > __________________________________________________ > Do you Yahoo!? > The New Yahoo! Search - Faster. Easier. Bingo > http://search.yahoo.com > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > openjms-user mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/openjms-user > |