java.util.Timer
makes the following promise: This class scales to large numbers of concurrently scheduled tasks (thousands should present no problem). Fine, I like it. So I wanted to arrange a timer to take care of thousands of not very sensitive to real-time guarantees tasks. The only concern was performance, so I created an object pool to avoid creation of new java.util.TimerTask
objects every time I need them. The intention was to reuse canceled and executed tasks from the pool. The quirk was that the Timer implementation rejects such Task objects! When I looked at the source code of Timer, it turned out that java.util.Timer.sched(TimerTask task, long time, long period)
method rejects Task if it is not in VIRGIN
state. Is it Shariah Law based decision? And there is no way to change this idiosyncrasy by deriving from Task, because state
data member has package visibility and no setter.Isn't it a good example of how politics affects software design?
No comments:
Post a Comment