Hi Tobias,

I've checked your code, and the testcase does stop in 5 seconds, but the thread 
does not. 
The cancelation of the future triggers an exception in the resources, which 
causes the test 
to terminate, thereby stopping the vm and the thread. However, if you add this 
to your 
testcase:
try {
  wicketTester.startResourceReference(reference);
} finally {
  reference.getScheduledExecutorService().shutdownNow();
  reference.getScheduledExecutorService().awaitTermination(
      1, TimeUnit.MINUTES);
}
You will see that after 1 minute, the executor is still not terminated.

Also, when executing my other script, I get a java.lang.OutOfMemoryError after 
only 3 
seconds.

Best regards,
Emond

On Thursday, January 07, 2016 12:21:42 PM Tobias Soloschenko wrote:
> Hi again,
> 
> I updated the PR - just check it out, open the
> NashornResourceReferenceTest.js and add:
> 
> while(true){}
> 
> For me the unit test stops running after 5 seconds.
> 
> I also added the class filter to reject all if no own filter is defined by
> overriding the corresponding method.
> 
> kind regards
> 
> Tobias
> 
> > Am 07.01.2016 um 11:49 schrieb Emond Papegaaij
> > <[email protected]>:
> > 
> > Hi Tobias,
> > 
> > Future.cancel will attempt to interrupt the thread, but this will not stop
> > a thread executing 'while(true);'. It will stop a thread executing
> > 'while(!isInterrupted());'. There is no way to safely stop a thread in
> > Java (other than stopping the entire VM).
> > 
> > Best regards,
> > Emond
> > 
> >> On Thursday, January 07, 2016 11:12:31 AM Tobias Soloschenko wrote:
> >> Hi,
> >> 
> >> I use ScheduledExecutorService and cancel - I am going to submit and show
> >> you the changes this evening.
> >> 
> >> kind regards
> >> 
> >> Tobias
> >> 
> >>> Am 07.01.2016 um 10:50 schrieb Emond Papegaaij
> >>> <[email protected]>:
> >>> 
> >>> Hi Tobias,
> >>> 
> >>> How do you terminate a thread? The only way to terminate a Thread from

Reply via email to