[ 
https://issues.apache.org/jira/browse/LENS-954?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ted Yu updated LENS-954:
------------------------
    Description: 
{code}
  private void waitUntilNotEmpty() throws InterruptedException {

    conditionalWaitLock.lock();
    try {
      notEmpty.await();
    } finally {
      conditionalWaitLock.unlock();
    }
{code}

>From 
>http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#wait%28long%29
> :

A thread can wake up without being notified, interrupted, a so-called spurious 
wakeup. While this will rarely occur in practice, applications must guard 
against it by testing for the condition that should have caused the thread to 
be awakened.

  was:
{code}
  private void waitUntilNotEmpty() throws InterruptedException {

    conditionalWaitLock.lock();
    try {
      notEmpty.await();
    } finally {
      conditionalWaitLock.unlock();
    }
{code}
>From 
>http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#wait%28long%29
> :

A thread can wake up without being notified, interrupted, a so-called spurious 
wakeup. While this will rarely occur in practice, applications must guard 
against it by testing for the condition that should have caused the thread to 
be awakened.


> await() is not inside loop in FairPriorityBlockingQueue#waitUntilNotEmpty()
> ---------------------------------------------------------------------------
>
>                 Key: LENS-954
>                 URL: https://issues.apache.org/jira/browse/LENS-954
>             Project: Apache Lens
>          Issue Type: Bug
>          Components: server
>            Reporter: Ted Yu
>            Priority: Minor
>
> {code}
>   private void waitUntilNotEmpty() throws InterruptedException {
>     conditionalWaitLock.lock();
>     try {
>       notEmpty.await();
>     } finally {
>       conditionalWaitLock.unlock();
>     }
> {code}
> From 
> http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#wait%28long%29
>  :
> A thread can wake up without being notified, interrupted, a so-called 
> spurious wakeup. While this will rarely occur in practice, applications must 
> guard against it by testing for the condition that should have caused the 
> thread to be awakened.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to