Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6350741
Votes 0
Synopsis CyclicBarrier notification that barrier has been entered
Category java:classes_util_concurrent
Reported Against
Release Fixed
State 3-Accepted, request for enhancement
Priority: 4-Low
Related Bugs
Submit Date 15-NOV-2005
Description
A DESCRIPTION OF THE REQUEST :
Testing concurrent code is hard.  I find myself using a sleep() call in one thread so I can test what happens when another thread is first to enter await().  This delay has to be conservative, of course, given that other things contend for the CPU.  This means that the test takes a whole lot longer than would be optimal.

Instead of sleep(), I'd like to use a CountDownLatch.  So in the one thread, I do this
  latch.await() // maybe with a timeout
and in the other thread, when the code enters barrier.await(), it invokes a listener that does this
  latch.countDown()

I fear that this all boils down to wanting a notification when wait() has been entered on some objec, which of course would make this into a major request with far-reaching performance implications.  I hope not.  If so, then there could be a flag to the VM for a testing mode in which such things are possible.

JUSTIFICATION :
Speeding up test code.
Posted Date : 2005-11-15 22:40:28.0
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   

Submitted On 16-NOV-2005
daveyost
I entered this bug.



PLEASE NOTE: JDK6 is formerly known as Project Mustang