Skip to content

Commit

Permalink
HDFS-3659. Add missing @OverRide to methods across the hadoop-hdfs pr…
Browse files Browse the repository at this point in the history
…oject. Contributed by Brandon Li. (harsh)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1361894 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
QwertyManiac committed Jul 16, 2012
1 parent ae6cc14 commit 0e8e499
Show file tree
Hide file tree
Showing 142 changed files with 347 additions and 1 deletion.
3 changes: 3 additions & 0 deletions hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ Branch-2 ( Unreleased changes )
HDFS-3663. MiniDFSCluster should capture the code path that led to
the first ExitException. (eli)

HDFS-3659. Add missing @Override to methods across the hadoop-hdfs
project. (Brandon Li via harsh)

OPTIMIZATIONS

HDFS-2982. Startup performance suffers when there are many edit log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ private void closeAllFilesBeingWritten(final boolean abort) {
* Close the file system, abandoning all of the leases and files being
* created and close connections to the namenode.
*/
@Override
public synchronized void close() throws IOException {
if(clientRunning) {
closeAllFilesBeingWritten(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ private boolean isHeartbeatPacket() {
return seqno == HEART_BEAT_SEQNO;
}

@Override
public String toString() {
return "packet seqno:" + this.seqno +
" offsetInBlock:" + this.offsetInBlock +
Expand Down Expand Up @@ -396,6 +397,7 @@ private void endBlock() {
* streamer thread is the only thread that opens streams to datanode,
* and closes them. Any error recovery is also done by this thread.
*/
@Override
public void run() {
long lastPacket = Time.now();
while (!streamerClosed && dfsClient.clientRunning) {
Expand Down Expand Up @@ -654,6 +656,7 @@ private class ResponseProcessor extends Daemon {
this.targets = targets;
}

@Override
public void run() {

setName("ResponseProcessor for block " + block);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public int compare(DatanodeInfo a, DatanodeInfo b) {
* Address matcher for matching an address to local address
*/
static final AddressMatcher LOCAL_ADDRESS_MATCHER = new AddressMatcher() {
@Override
public boolean match(InetSocketAddress s) {
return NetUtils.isLocalAddress(s.getAddress());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static final SimpleDateFormat getDateFormat() {

protected static final ThreadLocal<SimpleDateFormat> df =
new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return getDateFormat();
}
Expand Down Expand Up @@ -240,6 +241,7 @@ public synchronized Token<?> getDelegationToken(final String renewer
//Renew TGT if needed
ugi.reloginFromKeytab();
return ugi.doAs(new PrivilegedExceptionAction<Token<?>>() {
@Override
public Token<?> run() throws IOException {
final String nnHttpUrl = nnSecureUri.toString();
Credentials c;
Expand Down Expand Up @@ -402,6 +404,7 @@ class LsParser extends DefaultHandler {

ArrayList<FileStatus> fslist = new ArrayList<FileStatus>();

@Override
public void startElement(String ns, String localname, String qname,
Attributes attrs) throws SAXException {
if ("listing".equals(qname)) return;
Expand Down Expand Up @@ -541,6 +544,7 @@ public Path getWorkingDirectory() {
public void setWorkingDirectory(Path f) { }

/** This optional operation is not yet supported. */
@Override
public FSDataOutputStream append(Path f, int bufferSize,
Progressable progress) throws IOException {
throw new IOException("Not supported");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ protected HttpURLConnection openConnection(String path, String query)
* Dummy hostname verifier that is used to bypass hostname checking
*/
protected static class DummyHostnameVerifier implements HostnameVerifier {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
Expand All @@ -198,12 +199,15 @@ public boolean verify(String hostname, SSLSession session) {
* Dummy trustmanager that is used to trust all server certificates
*/
protected static class DummyTrustManager implements X509TrustManager {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}

@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {
}

@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public synchronized void clear() {
multimap.clear();
}

@Override
protected void finalize() {
clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class Block implements Writable, Comparable<Block> {
WritableFactories.setFactory
(Block.class,
new WritableFactory() {
@Override
public Writable newInstance() { return new Block(); }
});
}
Expand Down Expand Up @@ -146,6 +147,7 @@ public void setGenerationStamp(long stamp) {

/**
*/
@Override
public String toString() {
return getBlockName() + "_" + getGenerationStamp();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,12 @@ public class BlockReportIterator implements Iterator<Block> {
this.currentReplicaState = null;
}

@Override
public boolean hasNext() {
return currentBlockIndex < getNumberOfBlocks();
}

@Override
public Block next() {
block.set(blockId(currentBlockIndex),
blockLength(currentBlockIndex),
Expand All @@ -161,6 +163,7 @@ public Block next() {
return block;
}

@Override
public void remove() {
throw new UnsupportedOperationException("Sorry. can't remove.");
}
Expand All @@ -178,6 +181,7 @@ public ReplicaState getCurrentReplicaState() {
/**
* Returns an iterator over blocks in the block report.
*/
@Override
public Iterator<Block> iterator() {
return getBlockReportIterator();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public DSQuotaExceededException(long quota, long count) {
super(quota, count);
}

@Override
public String getMessage() {
String msg = super.getMessage();
if (msg == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public int getIpcPort() {
return ipcPort;
}

@Override
public boolean equals(Object to) {
if (this == to) {
return true;
Expand All @@ -161,10 +162,12 @@ public boolean equals(Object to) {
storageID.equals(((DatanodeID)to).getStorageID()));
}

@Override
public int hashCode() {
return getXferAddr().hashCode()^ storageID.hashCode();
}

@Override
public String toString() {
return getXferAddr();
}
Expand All @@ -187,6 +190,7 @@ public void updateRegInfo(DatanodeID nodeReg) {
* @param that
* @return as specified by Comparable
*/
@Override
public int compareTo(DatanodeID that) {
return getXferAddr().compareTo(that.getXferAddr());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public enum AdminStates {
this.value = v;
}

@Override
public String toString() {
return value;
}
Expand Down Expand Up @@ -126,6 +127,7 @@ public DatanodeInfo(final String ipAddr, final String hostName,
}

/** Network location name */
@Override
public String getName() {
return getXferAddr();
}
Expand Down Expand Up @@ -200,9 +202,11 @@ public void setXceiverCount(int xceiverCount) {
}

/** network location */
@Override
public synchronized String getNetworkLocation() {return location;}

/** Sets the network location */
@Override
public synchronized void setNetworkLocation(String location) {
this.location = NodeBase.normalize(location);
}
Expand Down Expand Up @@ -334,13 +338,17 @@ protected void setAdminState(AdminStates newState) {
private transient Node parent; //its parent

/** Return this node's parent */
@Override
public Node getParent() { return parent; }
@Override
public void setParent(Node parent) {this.parent = parent;}

/** Return this node's level in the tree.
* E.g. the root of a tree returns 0 and its children return 1
*/
@Override
public int getLevel() { return level; }
@Override
public void setLevel(int level) {this.level = level;}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public int findBlock(long offset) {
Comparator<LocatedBlock> comp =
new Comparator<LocatedBlock>() {
// Returns 0 iff a is inside b or b is inside a
@Override
public int compare(LocatedBlock a, LocatedBlock b) {
long aBeg = a.getStartOffset();
long bBeg = b.getStartOffset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public NSQuotaExceededException(long quota, long count) {
super(quota, count);
}

@Override
public String getMessage() {
String msg = super.getMessage();
if (msg == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void setPathName(String path) {
this.pathName = path;
}

@Override
public String getMessage() {
return super.getMessage();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public ClientNamenodeProtocolTranslatorPB(ClientNamenodeProtocolPB proxy)
rpcProxy = proxy;
}

@Override
public void close() {
RPC.stopProxy(rpcProxy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public NamenodeProtocolTranslatorPB(NamenodeProtocolPB rpcProxy) {
this.rpcProxy = rpcProxy;
}

@Override
public void close() {
RPC.stopProxy(rpcProxy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ static boolean isEqual(Object a, Object b) {
}

/** {@inheritDoc} */
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
Expand All @@ -135,12 +136,14 @@ && isEqual(this.blockPoolId, that.blockPoolId)
}

/** {@inheritDoc} */
@Override
public int hashCode() {
return (int) expiryDate ^ keyId ^ (int) blockId ^ modes.hashCode()
^ (userId == null ? 0 : userId.hashCode())
^ (blockPoolId == null ? 0 : blockPoolId.hashCode());
}

@Override
public void readFields(DataInput in) throws IOException {
this.cache = null;
expiryDate = WritableUtils.readVLong(in);
Expand All @@ -155,6 +158,7 @@ public void readFields(DataInput in) throws IOException {
}
}

@Override
public void write(DataOutput out) throws IOException {
WritableUtils.writeVLong(out, expiryDate);
WritableUtils.writeVInt(out, keyId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@InterfaceAudience.Private
public class BlockTokenSelector implements TokenSelector<BlockTokenIdentifier> {

@Override
@SuppressWarnings("unchecked")
public Token<BlockTokenIdentifier> selectToken(Text service,
Collection<Token<? extends TokenIdentifier>> tokens) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public BlockKey[] getAllKeys() {
static { // register a ctor
WritableFactories.setFactory(ExportedBlockKeys.class,
new WritableFactory() {
@Override
public Writable newInstance() {
return new ExportedBlockKeys();
}
Expand All @@ -86,6 +87,7 @@ public Writable newInstance() {

/**
*/
@Override
public void write(DataOutput out) throws IOException {
out.writeBoolean(isBlockTokenEnabled);
out.writeLong(keyUpdateInterval);
Expand All @@ -99,6 +101,7 @@ public void write(DataOutput out) throws IOException {

/**
*/
@Override
public void readFields(DataInput in) throws IOException {
isBlockTokenEnabled = in.readBoolean();
keyUpdateInterval = in.readLong();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ private void reset() {
/* start a thread to dispatch the block move */
private void scheduleBlockMove() {
moverExecutor.execute(new Runnable() {
@Override
public void run() {
if (LOG.isDebugEnabled()) {
LOG.debug("Starting moving "+ block.getBlockId() +
Expand Down Expand Up @@ -570,6 +571,7 @@ private class Source extends BalancerDatanode {
/* A thread that initiates a block move
* and waits for block move to complete */
private class BlockMoveDispatcher implements Runnable {
@Override
public void run() {
dispatchBlocks();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public String toString() {
* Periodically updates access keys.
*/
class BlockKeyUpdater implements Runnable {
@Override
public void run() {
try {
while (shouldRun) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class BlockPlacementPolicyWithNodeGroup extends BlockPlacementPolicyDefau
BlockPlacementPolicyWithNodeGroup() {
}

@Override
public void initialize(Configuration conf, FSClusterStats stats,
NetworkTopology clusterMap) {
super.initialize(conf, stats, clusterMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ private static class NodeIterator implements Iterator<DatanodeDescriptor> {
this.blockInfo = blkInfo;
}

@Override
public boolean hasNext() {
return blockInfo != null && nextIdx < blockInfo.getCapacity()
&& blockInfo.getDatanode(nextIdx) != null;
}

@Override
public DatanodeDescriptor next() {
return blockInfo.getDatanode(nextIdx++);
}

@Override
public void remove() {
throw new UnsupportedOperationException("Sorry. can't remove.");
}
Expand Down
Loading

0 comments on commit 0e8e499

Please sign in to comment.