001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hbase.master.normalizer; 019 020import org.apache.commons.lang3.builder.EqualsBuilder; 021import org.apache.commons.lang3.builder.HashCodeBuilder; 022import org.apache.commons.lang3.builder.ToStringBuilder; 023import org.apache.commons.lang3.builder.ToStringStyle; 024import org.apache.hadoop.hbase.client.RegionInfo; 025import org.apache.yetus.audience.InterfaceAudience; 026 027/** 028 * Normalization plan to split a region. 029 */ 030@InterfaceAudience.Private 031final class SplitNormalizationPlan implements NormalizationPlan { 032 033 private final NormalizationTarget splitTarget; 034 035 SplitNormalizationPlan(final RegionInfo splitTarget, final long splitTargetSizeMb) { 036 this.splitTarget = new NormalizationTarget(splitTarget, splitTargetSizeMb); 037 } 038 039 @Override 040 public PlanType getType() { 041 return PlanType.SPLIT; 042 } 043 044 public NormalizationTarget getSplitTarget() { 045 return splitTarget; 046 } 047 048 @Override 049 public String toString() { 050 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE) 051 .append("splitTarget", splitTarget).toString(); 052 } 053 054 @Override 055 public boolean equals(Object o) { 056 if (this == o) { 057 return true; 058 } 059 060 if (o == null || getClass() != o.getClass()) { 061 return false; 062 } 063 064 SplitNormalizationPlan that = (SplitNormalizationPlan) o; 065 066 return new EqualsBuilder().append(splitTarget, that.splitTarget).isEquals(); 067 } 068 069 @Override 070 public int hashCode() { 071 return new HashCodeBuilder(17, 37).append(splitTarget).toHashCode(); 072 } 073}