- nn.namesystem.now() should be FSNamesystem.now()
- Methods should be separate by a blank line.
- there is to many methods called getBlockLocationsInternal(). It took me at least 20 minutes to understand who is calling whom. Traditionally the general idea of methods and their *Internal counterparts is to distinguish between the api methods and their synchronized parts. Synchronized part of the implementation is usually called *Internal. It is also supposed to be private.
I propose the following modifications here:
- getBlockLocationsInternal(String src,long,long) should be renamed to getBlockLocations(String src,long,long) because you need to call ii in NamenodeFsck.
- getBlockLocationsInternal(String clientMachine,String src,long,long) should be removed and the sorting part of it should be placed directly into getBlockLocations(String clientMachine,String src,long,long).
- the private getBlockLocationInternal(INodeFile, ...) should be renamed to getBlockLocationsInternal(INodeFile, ...) with an 's' in the middle. This was probably my fault.
As a result you will have only one private synchronized getBlockLocationsInternal() and two getBlockLocations().