3
|
JRL · 技术社区 · 14 年前 |
![]() |
1
3
You might find this simpler.
|
![]() |
2
2
毕竟…you have to use a TimerTask in combination with a Timer . I hope this is the final installment :)! You should try something like this:
|
![]() |
3
1
Yeap, I think it is possible. You just have to keep somewhere the deadline for the task and then using a
Here's a complete example. It's far from perfect but just is the proof of concept on how should it work.
对于可运行列表,您可以启动一个新的
注意Runnabes没有意识到它们是否会永远运行。 In the code below, I reschedule every second, and the random is within a 10 secs range, but you can reschedule every millisecond, and up to whatever time is reasonable for you. 例如:
With this proof of concept, you could use a queue and put out the runnables while they are executing and put them back when they have finished their execution, instead of using a simple list. Also, there might be some synchronization issues, but with the information you provided I think this would be enough. I hope it helps. |