下面列出了org.apache.hadoop.hbase.client.HBaseAdmin#assign ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@VisibleForTesting
static void move(Args args, HBaseAdmin admin, String tableName, String targetServerName, String encodedRegionName,
boolean asynchronous)
throws IOException, InterruptedException {
int i;
for (i = 0; i < Constant.TRY_MAX; i++) {
try {
admin.move(encodedRegionName.getBytes(), targetServerName.getBytes());
} catch (java.lang.reflect.UndeclaredThrowableException ignore) {
}
if (asynchronous)
return;
if (CommandAdapter.isMetaTable(tableName))
return;
if (!isTableEnabled(args, admin, tableName))
throw new IllegalStateException(Constant.MESSAGE_DISABLED_OR_NOT_FOUND_TABLE);
if (Util.isMoved(admin, tableName, encodedRegionName, targetServerName)) {
return;
}
Thread.sleep(Constant.WAIT_INTERVAL_MS);
// assign region again
if (i >= Constant.TRY_MAX / 2)
admin.assign(encodedRegionName.getBytes());
}
if (i >= Constant.TRY_MAX)
throw new IllegalStateException(Constant.MESSAGE_CANNOT_MOVE + " - "
+ encodedRegionName + " to " + targetServerName);
}
@VisibleForTesting
static void move(Args args, HBaseAdmin admin, String tableName, String targetServerName, String encodedRegionName,
boolean asynchronous)
throws IOException, InterruptedException {
int i;
for (i = 0; i < Constant.TRY_MAX; i++) {
try {
admin.move(encodedRegionName.getBytes(), targetServerName.getBytes());
} catch (java.lang.reflect.UndeclaredThrowableException ignore) {
}
if (asynchronous)
return;
if (CommandAdapter.isMetaTable(tableName))
return;
if (!isTableEnabled(args, admin, tableName))
throw new IllegalStateException(Constant.MESSAGE_DISABLED_OR_NOT_FOUND_TABLE);
if (Util.isMoved(admin, tableName, encodedRegionName, targetServerName)) {
return;
}
Thread.sleep(Constant.WAIT_INTERVAL_MS);
// assign region again
if (i >= Constant.TRY_MAX / 2)
admin.assign(encodedRegionName.getBytes());
}
if (i >= Constant.TRY_MAX)
throw new IllegalStateException(Constant.MESSAGE_CANNOT_MOVE + " - "
+ encodedRegionName + " to " + targetServerName);
}
@VisibleForTesting
static void move(Args args, HBaseAdmin admin, String tableName, String targetServerName, String encodedRegionName,
boolean asynchronous)
throws IOException, InterruptedException {
int i;
for (i = 0; i < Constant.TRY_MAX; i++) {
try {
admin.move(encodedRegionName.getBytes(), targetServerName.getBytes());
} catch (java.lang.reflect.UndeclaredThrowableException ignore) {
}
if (asynchronous)
return;
if (CommandAdapter.isMetaTable(tableName))
return;
if (!isTableEnabled(args, admin, tableName))
throw new IllegalStateException(Constant.MESSAGE_DISABLED_OR_NOT_FOUND_TABLE);
if (Util.isMoved(admin, tableName, encodedRegionName, targetServerName)) {
return;
}
Thread.sleep(Constant.WAIT_INTERVAL_MS);
// assign region again
if (i >= Constant.TRY_MAX / 2)
admin.assign(encodedRegionName.getBytes());
}
if (i >= Constant.TRY_MAX)
throw new IllegalStateException(Constant.MESSAGE_CANNOT_MOVE + " - "
+ encodedRegionName + " to " + targetServerName);
}
@VisibleForTesting
static void move(Args args, HBaseAdmin admin, String tableName, String targetServerName, String encodedRegionName,
boolean asynchronous)
throws IOException, InterruptedException {
int i;
for (i = 0; i < Constant.TRY_MAX; i++) {
try {
admin.move(encodedRegionName.getBytes(), targetServerName.getBytes());
} catch (java.lang.reflect.UndeclaredThrowableException ignore) {
}
if (asynchronous)
return;
if (CommandAdapter.isMetaTable(tableName))
return;
if (!isTableEnabled(args, admin, tableName))
throw new IllegalStateException(Constant.MESSAGE_DISABLED_OR_NOT_FOUND_TABLE);
if (Util.isMoved(admin, tableName, encodedRegionName, targetServerName)) {
return;
}
Thread.sleep(Constant.WAIT_INTERVAL_MS);
// assign region again
if (i >= Constant.TRY_MAX / 2)
admin.assign(encodedRegionName.getBytes());
}
if (i >= Constant.TRY_MAX)
throw new IllegalStateException(Constant.MESSAGE_CANNOT_MOVE + " - "
+ encodedRegionName + " to " + targetServerName);
}
@VisibleForTesting
static void move(Args args, HBaseAdmin admin, String tableName, String targetServerName, String encodedRegionName,
boolean asynchronous)
throws IOException, InterruptedException {
int i;
for (i = 0; i < Constant.TRY_MAX; i++) {
try {
admin.move(encodedRegionName.getBytes(), targetServerName.getBytes());
} catch (java.lang.reflect.UndeclaredThrowableException ignore) {
}
if (asynchronous)
return;
if (CommandAdapter.isMetaTable(tableName))
return;
if (!isTableEnabled(args, admin, tableName))
throw new IllegalStateException(Constant.MESSAGE_DISABLED_OR_NOT_FOUND_TABLE);
if (Util.isMoved(admin, tableName, encodedRegionName, targetServerName)) {
return;
}
Thread.sleep(Constant.WAIT_INTERVAL_MS);
// assign region again
if (i >= Constant.TRY_MAX / 2)
admin.assign(encodedRegionName.getBytes());
}
if (i >= Constant.TRY_MAX)
throw new IllegalStateException(Constant.MESSAGE_CANNOT_MOVE + " - "
+ encodedRegionName + " to " + targetServerName);
}