HBASE-19512 Move EventType and ExecutorType from hbase-client to hbase-server

This commit is contained in:
zhangduo 2017-12-14 17:34:27 +08:00
parent a1f8821b85
commit c2bb63fbf9
2 changed files with 10 additions and 16 deletions

View File

@ -1,5 +1,4 @@
/** /**
*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -16,7 +15,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.executor; package org.apache.hadoop.hbase.executor;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
@ -295,20 +293,18 @@ public enum EventType {
} }
public static EventType get(final int code) { public static EventType get(final int code) {
// Is this going to be slow? Its used rare but still... // Is this going to be slow? Its used rare but still...
for (EventType et: EventType.values()) { for (EventType et : EventType.values()) {
if (et.getCode() == code) return et; if (et.getCode() == code) {
return et;
}
} }
throw new IllegalArgumentException("Unknown code " + code); throw new IllegalArgumentException("Unknown code " + code);
} }
public boolean isOnlineSchemaChangeSupported() { public boolean isOnlineSchemaChangeSupported() {
return ( return this.equals(EventType.C_M_ADD_FAMILY) || this.equals(EventType.C_M_DELETE_FAMILY) ||
this.equals(EventType.C_M_ADD_FAMILY) || this.equals(EventType.C_M_MODIFY_FAMILY) || this.equals(EventType.C_M_MODIFY_TABLE);
this.equals(EventType.C_M_DELETE_FAMILY) ||
this.equals(EventType.C_M_MODIFY_FAMILY) ||
this.equals(EventType.C_M_MODIFY_TABLE)
);
} }
ExecutorType getExecutorServiceType() { ExecutorType getExecutorServiceType() {

View File

@ -1,5 +1,4 @@
/** /**
*
* Licensed to the Apache Software Foundation (ASF) under one * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file * or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information * distributed with this work for additional information
@ -16,7 +15,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.hadoop.hbase.executor; package org.apache.hadoop.hbase.executor;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
@ -50,11 +48,11 @@ public enum ExecutorType {
RS_COMPACTED_FILES_DISCHARGER (29), RS_COMPACTED_FILES_DISCHARGER (29),
RS_OPEN_PRIORITY_REGION (30); RS_OPEN_PRIORITY_REGION (30);
ExecutorType(int value) {} ExecutorType(int value) {
}
/** /**
* @param serverName * @return Conflation of the executor type and the passed {@code serverName}.
* @return Conflation of the executor type and the passed servername.
*/ */
String getExecutorName(String serverName) { String getExecutorName(String serverName) {
return this.toString() + "-" + serverName.replace("%", "%%"); return this.toString() + "-" + serverName.replace("%", "%%");