RFR (s): 4354680: Runtime.runFinalization() silently clears interrupted flag in the calling thread
Stanimir Simeonoff
stanimir at riflexo.com
Thu Oct 30 06:00:39 UTC 2014
> Aside, I noticed in this code:
>
> 146 forkSecondaryFinalizer(new Runnable() {
> 147 private volatile boolean running;
> 148 public void run() {
> 149 if (running)
> 150 return;
> 151 final JavaLangAccess jla = SharedSecrets.
> getJavaLangAccess();
> 152 running = true;
>
> that as we create a new Runnable on every call, the "running" field serves
> absolutely no purpose.
>
> Cheers,
> David
>
It could be defense vs Thread.currentThread().run() in finalizer that would
cause calling run() of Thread.target. I am not sure if that would cause
invocation, though.
But I have done similar "non-senses"...
Stanimir
More information about the core-libs-dev
mailing list