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.
Testcase to reproduce public void testRP() throws Exception { final RequestProcessor RP = new RequestProcessor("BrokenRP", 2); final AtomicBoolean outerDone = new AtomicBoolean(false); RequestProcessor.Task outerTask; outerTask = RP.post(new Runnable() { @Override public void run() { final AtomicBoolean innerDone = new AtomicBoolean(false); RequestProcessor.Task innerTask = RP.post(new Runnable() { @Override public void run() { System.err.println("Task1 start"); try { Thread.sleep(5000); } catch (InterruptedException ex) { Exceptions.printStackTrace(ex); } System.err.println("Task1 finished 1"); innerDone.set(true); System.err.println("Task1 finished marked"); } }); System.err.println("wait Task1"); innerTask.waitFinished(); System.err.println("after wait Task1 " + innerDone); outerDone.set(innerDone.get()); } }); outerTask.waitFinished(); System.err.println("after wait Post " + outerDone); assertTrue(outerDone.get()); }
Jarda, please, have a look
I can confirm the bug with Product Version: NetBeans IDE 7.2 (Build 201207171143) Java: 1.6.0_37; Java HotSpot(TM) 64-Bit Server VM 20.12-b01 System: Windows 7 version 6.1 running on amd64; Cp1252; de_CH (nb) Workaround: Use a different RequestProcessor for the 'outerTask': in this case the call innerTask.waitFinished(); will work as expected.
thanks, for now we use CountDownLatch.await instead of Task.waitFinished to workaround this bug.
Jarda, this needs to be handled by you. Thanks.
waitFinished() detects isRequestProcessorThread() in spite the task is running in another thread (of the same processor).
Created attachment 136454 [details] Patch with test
ergonomics#957aa87a15ad
Integrated into 'main-silver', will be available in build *201307162300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/957aa87a15ad User: Jaroslav Tulach <jtulach@netbeans.org> Log: #226288: In case of RP with throughput more than one, check whether the task is not running in other thread. If it does, we can still wait for it.