p***p 发帖数: 559 | 1 There is lots of timer taskes in my software, such as session time out, auto-
reload and clean.... I use TimerTask.run and Timer.schedule(...) to implement
them.
In order to save rescoure, I use a single Timer for all such taskes in my
Application(somehow as a static). My question is, could it be a performance
hit when tousand such taskes running on single Timer, or i'd better use more
timers. | c*****n 发帖数: 75 | 2
-
implement
From the Timer() class:
Implementation note: This class scales to large numbers of concurrently
scheduled tasks (thousands should present no problem). Internally, it uses a
binary heap to represent its task queue, so the cost to schedule a task is O(
log n), where n is the number of concurrently scheduled tasks.
【在 p***p 的大作中提到】 : There is lots of timer taskes in my software, such as session time out, auto- : reload and clean.... I use TimerTask.run and Timer.schedule(...) to implement : them. : In order to save rescoure, I use a single Timer for all such taskes in my : Application(somehow as a static). My question is, could it be a performance : hit when tousand such taskes running on single Timer, or i'd better use more : timers.
| p***p 发帖数: 559 | 3 Thanx, so the summery is?
(
【在 c*****n 的大作中提到】 : : - : implement : From the Timer() class: : Implementation note: This class scales to large numbers of concurrently : scheduled tasks (thousands should present no problem). Internally, it uses a : binary heap to represent its task queue, so the cost to schedule a task is O( : log n), where n is the number of concurrently scheduled tasks.
| c*****t 发帖数: 1879 | 4 Summary is that Sun's implementation is a great one. Don't bother to create
your own.
【在 p***p 的大作中提到】 : Thanx, so the summery is? : : (
|
|