dnrajugade / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

Add Uninterruptibles#awaitUninterruptibly() methods for java.util.concurrent.locks.Condition #1212

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The interface java.util.concurrent.locks.Condition has await() methods just 
like those of java.util.concurrent.CountDownLatch. It would be nice if the 
Uninterruptibles class had equivalent awaitUninterruptibly() methods for 
Condition.

Original issue reported on code.google.com by knut.wan...@gmail.com on 26 Nov 2012 at 8:17

GoogleCodeExporter commented 9 years ago
Condition provides a no-arg awaitUninterruptibly() to correspond to the no-arg 
await():
void await() => void awaitUninterruptibly()

So I guess you're asking about these two?
long awaitNanos(long nanosTimeout)
boolean awaitUntil(Date deadline)

Original comment by cpov...@google.com on 26 Nov 2012 at 7:02

GoogleCodeExporter commented 9 years ago
Yes, sorry for not making that clear. I was referring to uninterruptible 
methods corresponding to Condition#await(long, TimeUnit) and 
Condition#awaitUntil(Date).

Original comment by knut.wan...@gmail.com on 26 Nov 2012 at 8:40

GoogleCodeExporter commented 9 years ago
Thanks.

My stance on Uninterruptibles methods for java.util.concurrent classes is 
pretty much that we'll add whatever people need. They're just a little bit of a 
pain to test, so they're not something we can bang out in 5 minutes, so I don't 
know exactly when we'll get to this.

Original comment by cpov...@google.com on 26 Nov 2012 at 8:57

GoogleCodeExporter commented 9 years ago
awaitUntil(Date deadline) should not be added. All JUC classes relies on 
System.nanotime() not on System.currentTimeMillis()

Original comment by kaspe...@gmail.com on 5 Dec 2012 at 11:18

GoogleCodeExporter commented 9 years ago

Original comment by kak@google.com on 22 Aug 2013 at 11:33

GoogleCodeExporter commented 9 years ago
This isn't really what you are asking for, but I would suggest switching to use 
Monitor instead of Condition 
(http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/util/c
oncurrent/Monitor.html).

Monitor is easier to use (IMHO) and already supports a timed uninterruptible 
wait.

Original comment by lu...@google.com on 22 Aug 2013 at 11:38

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:13

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:18

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08