本文整理汇总了Java中org.apache.hadoop.hdfs.server.protocol.BlockCommand.getAction方法的典型用法代码示例。如果您正苦于以下问题:Java BlockCommand.getAction方法的具体用法?Java BlockCommand.getAction怎么用?Java BlockCommand.getAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hdfs.server.protocol.BlockCommand
的用法示例。
在下文中一共展示了BlockCommand.getAction方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convert
import org.apache.hadoop.hdfs.server.protocol.BlockCommand; //导入方法依赖的package包/类
public static BlockCommandProto convert(BlockCommand cmd) {
BlockCommandProto.Builder builder = BlockCommandProto.newBuilder()
.setBlockPoolId(cmd.getBlockPoolId());
switch (cmd.getAction()) {
case DatanodeProtocol.DNA_TRANSFER:
builder.setAction(BlockCommandProto.Action.TRANSFER);
break;
case DatanodeProtocol.DNA_INVALIDATE:
builder.setAction(BlockCommandProto.Action.INVALIDATE);
break;
case DatanodeProtocol.DNA_SHUTDOWN:
builder.setAction(BlockCommandProto.Action.SHUTDOWN);
break;
default:
throw new AssertionError("Invalid action");
}
Block[] blocks = cmd.getBlocks();
for (int i = 0; i < blocks.length; i++) {
builder.addBlocks(PBHelper.convert(blocks[i]));
}
builder.addAllTargets(PBHelper.convert(cmd.getTargets()));
return builder.build();
}
示例2: convert
import org.apache.hadoop.hdfs.server.protocol.BlockCommand; //导入方法依赖的package包/类
public static BlockCommandProto convert(BlockCommand cmd) {
BlockCommandProto.Builder builder =
BlockCommandProto.newBuilder().setBlockPoolId(cmd.getBlockPoolId());
switch (cmd.getAction()) {
case DatanodeProtocol.DNA_TRANSFER:
builder.setAction(BlockCommandProto.Action.TRANSFER);
break;
case DatanodeProtocol.DNA_INVALIDATE:
builder.setAction(BlockCommandProto.Action.INVALIDATE);
break;
case DatanodeProtocol.DNA_SHUTDOWN:
builder.setAction(BlockCommandProto.Action.SHUTDOWN);
break;
default:
throw new AssertionError("Invalid action");
}
Block[] blocks = cmd.getBlocks();
for (Block block : blocks) {
builder.addBlocks(PBHelper.convert(block));
}
builder.addAllTargets(PBHelper.convert(cmd.getTargets()));
return builder.build();
}
示例3: convert
import org.apache.hadoop.hdfs.server.protocol.BlockCommand; //导入方法依赖的package包/类
public static BlockCommandProto convert(BlockCommand cmd) {
BlockCommandProto.Builder builder = BlockCommandProto.newBuilder()
.setBlockPoolId(cmd.getBlockPoolId());
switch (cmd.getAction()) {
case DatanodeProtocol.DNA_TRANSFER:
builder.setAction(BlockCommandProto.Action.TRANSFER);
break;
case DatanodeProtocol.DNA_INVALIDATE:
builder.setAction(BlockCommandProto.Action.INVALIDATE);
break;
case DatanodeProtocol.DNA_SHUTDOWN:
builder.setAction(BlockCommandProto.Action.SHUTDOWN);
break;
default:
throw new AssertionError("Invalid action");
}
Block[] blocks = cmd.getBlocks();
for (int i = 0; i < blocks.length; i++) {
builder.addBlocks(PBHelper.convert(blocks[i]));
}
builder.addAllTargets(convert(cmd.getTargets()))
.addAllTargetStorageUuids(convert(cmd.getTargetStorageIDs()));
return builder.build();
}
示例4: convert
import org.apache.hadoop.hdfs.server.protocol.BlockCommand; //导入方法依赖的package包/类
public static BlockCommandProto convert(BlockCommand cmd) {
BlockCommandProto.Builder builder = BlockCommandProto.newBuilder()
.setBlockPoolId(cmd.getBlockPoolId());
switch (cmd.getAction()) {
case DatanodeProtocol.DNA_TRANSFER:
builder.setAction(BlockCommandProto.Action.TRANSFER);
break;
case DatanodeProtocol.DNA_INVALIDATE:
builder.setAction(BlockCommandProto.Action.INVALIDATE);
break;
case DatanodeProtocol.DNA_SHUTDOWN:
builder.setAction(BlockCommandProto.Action.SHUTDOWN);
break;
default:
throw new AssertionError("Invalid action");
}
Block[] blocks = cmd.getBlocks();
for (int i = 0; i < blocks.length; i++) {
builder.addBlocks(PBHelper.convert(blocks[i]));
}
builder.addAllTargets(convert(cmd.getTargets()))
.addAllTargetStorageUuids(convert(cmd.getTargetStorageIDs()));
StorageType[][] types = cmd.getTargetStorageTypes();
if (types != null) {
builder.addAllTargetStorageTypes(convert(types));
}
return builder.build();
}
示例5: convert
import org.apache.hadoop.hdfs.server.protocol.BlockCommand; //导入方法依赖的package包/类
public static BlockCommandProto convert(BlockCommand cmd) {
BlockCommandProto.Builder builder = BlockCommandProto.newBuilder()
.setBlockPoolId(cmd.getBlockPoolId());
switch (cmd.getAction()) {
case DatanodeProtocol.DNA_TRANSFER:
builder.setAction(BlockCommandProto.Action.TRANSFER);
break;
case DatanodeProtocol.DNA_INVALIDATE:
builder.setAction(BlockCommandProto.Action.INVALIDATE);
break;
case DatanodeProtocol.DNA_SHUTDOWN:
builder.setAction(BlockCommandProto.Action.SHUTDOWN);
break;
default:
throw new AssertionError("Invalid action");
}
Block[] blocks = cmd.getBlocks();
for (int i = 0; i < blocks.length; i++) {
builder.addBlocks(PBHelperClient.convert(blocks[i]));
}
builder.addAllTargets(PBHelperClient.convert(cmd.getTargets()))
.addAllTargetStorageUuids(convert(cmd.getTargetStorageIDs()));
StorageType[][] types = cmd.getTargetStorageTypes();
if (types != null) {
builder.addAllTargetStorageTypes(PBHelperClient.convert(types));
}
return builder.build();
}