由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Timer and TimerTask
相关主题
Why System.currentTimeMillis() is later then TimerTask.scheduledExecutionTime() in some cases?jvm是怎么implement monitor的?
java.util.timer的TimerTask有priority吗?is access to int[] faster than List?
这个Timer不退出是怎么回事儿?Sun要开源Java了
简单的schedule job, 你们用什么interface和implementation class
新手问一个多线程的问题今天写了一个游戏
Scala是用来干什么的如何动态地显示画线过程
can applet implements runnable?怎么在application实现delay?
问一个特别土的问题一个关于事件的问题
相关话题的讨论汇总
话题: timer话题: taskes话题: timertask话题: my话题: use
进入Java版参与讨论
1 (共1页)
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?
:
: (

1 (共1页)
进入Java版参与讨论
相关主题
一个关于事件的问题新手问一个多线程的问题
InputStream.read() 被block的问题(陷入无限等待)Scala是用来干什么的
怎么synchronize时间捏can applet implements runnable?
Java如何实现自动消失的消息框?问一个特别土的问题
Why System.currentTimeMillis() is later then TimerTask.scheduledExecutionTime() in some cases?jvm是怎么implement monitor的?
java.util.timer的TimerTask有priority吗?is access to int[] faster than List?
这个Timer不退出是怎么回事儿?Sun要开源Java了
简单的schedule job, 你们用什么interface和implementation class
相关话题的讨论汇总
话题: timer话题: taskes话题: timertask话题: my话题: use