| Author |
stop and restart thread
|
Mirza faisal
Greenhorn
Joined: Nov 20, 2008
Posts: 2
|
|
HELLO! i am using an array i.e long timeArray[10]={11152,4583,3456,2345,86564}; these are the time pointers for which thread have to sleep one by one.. but the case in which i am facing problem is that while running for example thread is sleeping for 2nd element of array (4583 seconds) at that time user presses Next button now thread should leave 2nd element of array and start sleeping for 3rd element i.e (3456 seconds) .... i have also stopped thread and start again but it creating some problems. i have also see the working of timers i can solve my problem but i didn't got any way to dynamically assign time to schedule function.. this could clear problem timer.schedule(myTask,0,1000); but i want timer.schedule(myTask,0,timeArray[i]); please help me ........ thanks in advance.......  [ November 20, 2008: Message edited by: Mirza faisal ]
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16680
|
|
I don't believe that there is something that does exactly what you want -- but it shouldn't be that hard to write one yourself. You will have to implement your own timer, that uses the array. Sorry... Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
 |
|
|
subject: stop and restart thread
|
|
|