[ 
https://issues.apache.org/jira/browse/HBASE-24898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17179652#comment-17179652
 ] 

Zheng Wang commented on HBASE-24898:
------------------------------------

The implementation show below.

{code:java}
  private static class OffPeakHoursImpl extends OffPeakHours {
    final int startHour;
    final int endHour;

    /**
     * @param startHour inclusive
     * @param endHour exclusive
     */
    OffPeakHoursImpl(int startHour, int endHour) {
      this.startHour = startHour;
      this.endHour = endHour;
    }

    @Override
    public boolean isOffPeakHour() {
      return isOffPeakHour(CurrentHourProvider.getCurrentHour());
    }

    @Override
    public boolean isOffPeakHour(int targetHour) {
      if (startHour <= endHour) {
        return startHour <= targetHour && targetHour < endHour;
      }
      return targetHour < endHour || startHour <= targetHour;
    }
  }
{code}

> Can not set 23:00~24:00 as offpeak hour now
> -------------------------------------------
>
>                 Key: HBASE-24898
>                 URL: https://issues.apache.org/jira/browse/HBASE-24898
>             Project: HBase
>          Issue Type: Bug
>          Components: tooling
>            Reporter: Zheng Wang
>            Assignee: Zheng Wang
>            Priority: Major
>
> The valid number in OffPeakHours is 0-23, and the end hour not included, so 
> we can not set 23:00-24:00 as offpeak hour now.
> My proposal is just change the valid number from 0-23 to 0-24, then we can 
> easily apply this pr to all active branchs, and folks do not need to change 
> them configuration.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to