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.
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 reference. Maybe it can be implemented directly in the RPs reschedule, but this way it it quite isolated and simple code.
Or assign back to me if you prefer, but it sounds like you already know what to do with it.
OK done using the technique similar to my original suggestion.