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

stack updated HBASE-1000:
-------------------------

    Attachment: hbase-1000.patch

Tripped over related issue in Chore.  Fixing this and Chore issue together.  
Any chance of a review Nitay?

> Sleeper.sleep does not go back to sleep when interrupted and no stop flag 
> given.
> --------------------------------------------------------------------------------
>
>                 Key: HBASE-1000
>                 URL: https://issues.apache.org/jira/browse/HBASE-1000
>             Project: Hadoop HBase
>          Issue Type: Bug
>          Components: util
>            Reporter: Nitay Joffe
>            Priority: Trivial
>         Attachments: hbase-1000.patch
>
>
> When interrupted, the Sleeper.sleep method should exit if the stop flag was 
> given, otherwise it should continue sleeping. Currently it seems to exits 
> regardless, which means the stop flag is meaningless.
> Here is the relevant code, from 
> src/java/org/apache/hadoop/hbase/util/Sleeper.java:
> {code}
>   public void sleep(final long startTime) {
>     if (this.stop.get()) {
>       return;
>     }
>     long now = System.currentTimeMillis();
>     long waitTime = this.period - (now - startTime);
>     if (waitTime > this.period) {
>       LOG.warn("Calculated wait time > " + this.period +
>         "; setting to this.period: " + System.currentTimeMillis() + ", " +
>         startTime);
>     }
>     if (waitTime > 0) {
>       try {
>         Thread.sleep(waitTime);
>         long slept = System.currentTimeMillis() - now;
>         if (slept > (10 * this.period)) {
>           LOG.warn("We slept " + slept + "ms, ten times longer than 
> scheduled: " +
>             this.period);
>         }
>       } catch(InterruptedException iex) {
>         // We we interrupted because we're meant to stop?  If not, just
>         // continue ignoring the interruption
>         if (this.stop.get()) {
>           return;
>         }
>       }
>     }
>   }
> {code}
> Essentially, the 'if (waitTime > 0)' portion needs to change to a while loop 
> so that the sleeping will continue after an interruption occurs. I'll attach 
> a patch when I get around to fixing it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to