Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public BlockInfo(short size) {

public BlockInfo(Block blk, short size) {
super(blk);
this.triplets = new Object[3*size];
this.triplets = new Object[3 * size];
this.bcId = INVALID_INODE_ID;
this.replication = isStriped() ? 0 : size;
}
Expand Down Expand Up @@ -126,34 +126,34 @@ public DatanodeDescriptor getDatanode(int index) {

DatanodeStorageInfo getStorageInfo(int index) {
assert this.triplets != null : "BlockInfo is not initialized";
assert index >= 0 && index*3 < triplets.length : "Index is out of bound";
return (DatanodeStorageInfo)triplets[index*3];
assert index >= 0 && index * 3 < triplets.length : "Index is out of bound";
return (DatanodeStorageInfo)triplets[index * 3];
}

BlockInfo getPrevious(int index) {
assert this.triplets != null : "BlockInfo is not initialized";
assert index >= 0 && index*3+1 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo)triplets[index*3+1];
assert index >= 0 && index * 3 + 1 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo)triplets[index * 3 + 1];
assert info == null ||
info.getClass().getName().startsWith(BlockInfo.class.getName()) :
"BlockInfo is expected at " + index*3;
"BlockInfo is expected at " + (index * 3 + 1);
return info;
}

BlockInfo getNext(int index) {
assert this.triplets != null : "BlockInfo is not initialized";
assert index >= 0 && index*3+2 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo)triplets[index*3+2];
assert index >= 0 && index * 3 + 2 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo)triplets[index * 3 + 2];
assert info == null || info.getClass().getName().startsWith(
BlockInfo.class.getName()) :
"BlockInfo is expected at " + index*3;
"BlockInfo is expected at " + (index * 3 + 2);
return info;
}

void setStorageInfo(int index, DatanodeStorageInfo storage) {
assert this.triplets != null : "BlockInfo is not initialized";
assert index >= 0 && index*3 < triplets.length : "Index is out of bound";
triplets[index*3] = storage;
assert index >= 0 && index * 3 < triplets.length : "Index is out of bound";
triplets[index * 3] = storage;
}

/**
Expand All @@ -166,9 +166,9 @@ void setStorageInfo(int index, DatanodeStorageInfo storage) {
*/
BlockInfo setPrevious(int index, BlockInfo to) {
assert this.triplets != null : "BlockInfo is not initialized";
assert index >= 0 && index*3+1 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo) triplets[index*3+1];
triplets[index*3+1] = to;
assert index >= 0 && index * 3 + 1 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo) triplets[index * 3 + 1];
triplets[index * 3 + 1] = to;
return info;
}

Expand All @@ -182,9 +182,9 @@ BlockInfo setPrevious(int index, BlockInfo to) {
*/
BlockInfo setNext(int index, BlockInfo to) {
assert this.triplets != null : "BlockInfo is not initialized";
assert index >= 0 && index*3+2 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo) triplets[index*3+2];
triplets[index*3+2] = to;
assert index >= 0 && index * 3 + 2 < triplets.length : "Index is out of bound";
BlockInfo info = (BlockInfo) triplets[index * 3 + 2];
triplets[index * 3 + 2] = to;
return info;
}

Expand Down