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

View File

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