Looking for a sponsor to review changes made to two unit tests under jdk/test

Mani Sarkar sadhak001 at gmail.com
Mon Apr 8 11:59:55 UTC 2013

Thanks Alan, David for your feedback.

So effectively you are saying the Thread.sleep(10) is fine in the test and
does not need to be re-written using any of the concurrency library methods.


On Mon, Apr 8, 2013 at 12:20 PM, David Holmes <david.holmes at oracle.com>wrote:

> Mani,
> Please go back to my original response. As Alan has just re-stated we do
> not need a latch or a semaphore here because we already do a join on the
> thread. As I have said the sleep is to allow the GC a chance to run (eg
> finalizer and/or reference processor thread).
> David
> On 8/04/2013 8:53 PM, Mani Sarkar wrote:
>> We initially introduced CountdownLatch and now Semaphore, to replace the
>> Thread.sleep(10) which took place before - what appears to be a forced GC
>> (am I right?):
>>               System.err.println("GC " + i);
>>               System.gc();
>>               System.runFinalization();
>> As the threads join at the ends of the other, then we can do away with the
>> Semaphore but how would we simulate the 10ms pause before the forced GC -
>> is that necessary? Can we still use Semaphores to implement pauses?
>> Cheers,
>> mani
>> On Mon, Apr 8, 2013 at 11:07 AM, Alan Bateman <Alan.Bateman at oracle.com>**
>> wrote:
>>  On 08/04/2013 10:39, Mani Sarkar wrote:
>>>  Hi David,
>>>> Here's the version of
>>>> *jdk8_tl/jdk/**test/java/lang/****ref/Basic.java*implemented using a
>>>> Semaphore:
>>>>   Hi Mani,
>>> Is there a handshake really needed here? From a quick look at the test
>>> then it looks to me that fork (used by createNoise) does a Thread.join so
>>> it waiting until the task is complete before it returns.
>>> -Alan

*Twitter:* @theNeomatrix369
*Blog:* http://neomatrix369.wordpress.com
*JUG activity:* LJC Advocate (@adoptopenjdk & @adoptajsr programs)
*Meet-a-Project:* https://github.com/MutabilityDetector
*Devoxx UK 2013 was a grand success:*
*Don't chase success, rather aim for "Excellence", and success will come
chasing after you!*

More information about the core-libs-dev mailing list