This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 31034 - TimedSoftReference tweaks
Summary: TimedSoftReference tweaks
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P4 blocker (vote)
Assignee: Petr Nejedly
Depends on:
Blocks: 13847
  Show dependency tree
Reported: 2003-02-13 16:30 UTC by Jesse Glick
Modified: 2008-12-22 21:26 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2003-02-13 16:30:41 UTC
From #13847:

I've looked at the TimedSoftRef. Functionally is
it OK,
but I'd suggest using a bit smarter scheme for
timeout impl:
The (re)schedule call is relatively expensive, it
does some
synchronization, allocates some objects and, worst
of all,
each schedule(time!=0) leaves a trail in the
TimerTask, a runnable
that will be executed (and possibly do nothing).
So the current impl would behave poorly for
sequences of get().

I suggest using this approach:
On first get() schedule a task (now+30000) and
record the
time-to-clear (now+30000). For subsequent get()s
(TTC is nonzero),
just update the TTC to now+30000.
In the timeout handler, compare "now" to TTC and
if it is bigger,
clear the reference and clear the TTC, otherwise
reschedule the task
using schedule(TTC-now).
That means at most one reschedule each 30000ms per

Maybe it can be implemented directly in the RPs
but this way it it quite isolated and simple code.
Comment 1 Jesse Glick 2003-02-13 16:31:27 UTC
Or assign back to me if you prefer, but it sounds like you already
know what to do with it.
Comment 2 Petr Nejedly 2003-02-25 12:23:16 UTC
OK done using the technique similar to my original suggestion.