HDFS-12719. Ozone: Fix checkstyle, javac, whitespace issues in HDFS-7240 branch. Contributed by Mukul Kumar Singh.

This commit is contained in:
Anu Engineer 2017-11-09 10:08:58 -08:00 committed by Owen O'Malley
parent 761926db2c
commit 740a06cdd7
30 changed files with 136 additions and 97 deletions

View File

@ -148,8 +148,8 @@ public int hashCode(){
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return (obj instanceof Property) && (((Property) obj).getName()).equals return (obj instanceof Property) && (((Property) obj).getName())
(this.getName()); .equals(this.getName());
} }
} }
} }

View File

@ -41,14 +41,14 @@ public interface ServiceRuntimeInfo {
String getVersion(); String getVersion();
/** /**
* Get the version of software running on the Namenode * Get the version of software running on the Namenode.
* *
* @return a string representing the version * @return a string representing the version
*/ */
String getSoftwareVersion(); String getSoftwareVersion();
/** /**
* Get the compilation information which contains date, user and branch * Get the compilation information which contains date, user and branch.
* *
* @return the compilation information, as a JSON string. * @return the compilation information, as a JSON string.
*/ */

View File

@ -332,8 +332,8 @@ public Builder setRequestID(String id) {
return this; return this;
} }
public Builder setType(ReplicationType type) { public Builder setType(ReplicationType replicationType) {
this.type = type; this.type = replicationType;
return this; return this;
} }

View File

@ -249,8 +249,8 @@ public Builder setState(OzoneProtos.LifeCycleState lifeCycleState) {
return this; return this;
} }
public Builder setPipeline(Pipeline pipeline) { public Builder setPipeline(Pipeline containerPipeline) {
this.pipeline = pipeline; this.pipeline = containerPipeline;
return this; return this;
} }
@ -269,18 +269,18 @@ public Builder setNumberOfKeys(long keyCount) {
return this; return this;
} }
public Builder setStateEnterTime(long stateEnterTime) { public Builder setStateEnterTime(long time) {
this.stateEnterTime = stateEnterTime; this.stateEnterTime = time;
return this; return this;
} }
public Builder setOwner(OzoneProtos.Owner owner) { public Builder setOwner(OzoneProtos.Owner containerOwner) {
this.owner = owner; this.owner = containerOwner;
return this; return this;
} }
public Builder setContainerName(String containerName) { public Builder setContainerName(String container) {
this.containerName = containerName; this.containerName = container;
return this; return this;
} }

View File

@ -17,6 +17,10 @@
MYNAME="${BASH_SOURCE-$0}" MYNAME="${BASH_SOURCE-$0}"
## @description usage info
## @audience private
## @stability evolving
## @replaceable no
function hadoop_usage function hadoop_usage
{ {
hadoop_add_option "--buildpaths" "attempt to add class files from build tree" hadoop_add_option "--buildpaths" "attempt to add class files from build tree"

View File

@ -17,7 +17,10 @@
# Start hadoop hdfs and ozone daemons. # Start hadoop hdfs and ozone daemons.
# Run this on master node. # Run this on master node.
## @description usage info
## @audience private
## @stability evolving
## @replaceable no
function hadoop_usage function hadoop_usage
{ {
echo "Usage: start-ozone.sh" echo "Usage: start-ozone.sh"

View File

@ -17,6 +17,10 @@
MYNAME="${BASH_SOURCE-$0}" MYNAME="${BASH_SOURCE-$0}"
## @description usage info
## @audience private
## @stability evolving
## @replaceable no
function hadoop_usage function hadoop_usage
{ {
hadoop_add_option "--buildpaths" "attempt to add class files from build tree" hadoop_add_option "--buildpaths" "attempt to add class files from build tree"

View File

@ -17,7 +17,10 @@
# Stop hdfs and ozone daemons. # Stop hdfs and ozone daemons.
# Run this on master node. # Run this on master node.
## @description usage info
## @audience private
## @stability evolving
## @replaceable no
function hadoop_usage function hadoop_usage
{ {
echo "Usage: stop-ozone.sh" echo "Usage: stop-ozone.sh"

View File

@ -434,88 +434,88 @@ private static long computeCacheSize(Configuration configuration,
/** /**
* Sets the Config to be used by this cache. * Sets the Config to be used by this cache.
* *
* @param configuration - Config * @param conf - Config
* @return Builder * @return Builder
*/ */
public Builder setConfiguration(Configuration configuration) { public Builder setConfiguration(Configuration conf) {
this.configuration = configuration; this.configuration = conf;
return this; return this;
} }
/** /**
* Sets the user name who is the owner of this volume. * Sets the user name who is the owner of this volume.
* *
* @param userName - name of the owner, please note this is not the current * @param user - name of the owner, please note this is not the current
* user name. * user name.
* @return - Builder * @return - Builder
*/ */
public Builder setUserName(String userName) { public Builder setUserName(String user) {
this.userName = userName; this.userName = user;
return this; return this;
} }
/** /**
* Sets the VolumeName. * Sets the VolumeName.
* *
* @param volumeName - Name of the volume * @param volume - Name of the volume
* @return Builder * @return Builder
*/ */
public Builder setVolumeName(String volumeName) { public Builder setVolumeName(String volume) {
this.volumeName = volumeName; this.volumeName = volume;
return this; return this;
} }
/** /**
* Sets the Pipelines that form this volume. * Sets the Pipelines that form this volume.
* *
* @param pipelines - list of pipelines * @param pipelineList - list of pipelines
* @return Builder * @return Builder
*/ */
public Builder setPipelines(List<Pipeline> pipelines) { public Builder setPipelines(List<Pipeline> pipelineList) {
this.pipelines = pipelines; this.pipelines = pipelineList;
return this; return this;
} }
/** /**
* Sets the Client Manager that manages the communication with containers. * Sets the Client Manager that manages the communication with containers.
* *
* @param clientManager - clientManager. * @param xceiverClientManager - clientManager.
* @return - Builder * @return - Builder
*/ */
public Builder setClientManager(XceiverClientManager clientManager) { public Builder setClientManager(XceiverClientManager xceiverClientManager) {
this.clientManager = clientManager; this.clientManager = xceiverClientManager;
return this; return this;
} }
/** /**
* Sets the block size -- Typical sizes are 4KB, 8KB etc. * Sets the block size -- Typical sizes are 4KB, 8KB etc.
* *
* @param blockSize - BlockSize. * @param size - BlockSize.
* @return - Builder * @return - Builder
*/ */
public Builder setBlockSize(int blockSize) { public Builder setBlockSize(int size) {
this.blockSize = blockSize; this.blockSize = size;
return this; return this;
} }
/** /**
* Sets the volumeSize. * Sets the volumeSize.
* *
* @param volumeSize - VolumeSize * @param size - VolumeSize
* @return - Builder * @return - Builder
*/ */
public Builder setVolumeSize(long volumeSize) { public Builder setVolumeSize(long size) {
this.volumeSize = volumeSize; this.volumeSize = size;
return this; return this;
} }
/** /**
* Set flusher. * Set flusher.
* @param flusher - cache Flusher * @param containerCacheFlusher - cache Flusher
* @return Builder. * @return Builder.
*/ */
public Builder setFlusher(ContainerCacheFlusher flusher) { public Builder setFlusher(ContainerCacheFlusher containerCacheFlusher) {
this.flusher = flusher; this.flusher = containerCacheFlusher;
return this; return this;
} }

View File

@ -321,9 +321,9 @@ public boolean isDaemonStopped() {
/** /**
* Create a command handler thread. * Create a command handler thread.
* *
* @param conf * @param config
*/ */
private void initCommandHandlerThread(Configuration conf) { private void initCommandHandlerThread(Configuration config) {
/** /**
* Task that periodically checks if we have any outstanding commands. * Task that periodically checks if we have any outstanding commands.

View File

@ -125,37 +125,37 @@ public Builder addHandler(CommandHandler handler) {
/** /**
* Add the OzoneContainer. * Add the OzoneContainer.
* *
* @param container - ozone container. * @param ozoneContainer - ozone container.
* @return Builder * @return Builder
*/ */
public Builder setContainer(OzoneContainer container) { public Builder setContainer(OzoneContainer ozoneContainer) {
Preconditions.checkNotNull(container); Preconditions.checkNotNull(ozoneContainer);
this.container = container; this.container = ozoneContainer;
return this; return this;
} }
/** /**
* Set the Connection Manager. * Set the Connection Manager.
* *
* @param connectionManager * @param scmConnectionManager
* @return this * @return this
*/ */
public Builder setConnectionManager(SCMConnectionManager public Builder setConnectionManager(SCMConnectionManager
connectionManager) { scmConnectionManager) {
Preconditions.checkNotNull(connectionManager); Preconditions.checkNotNull(scmConnectionManager);
this.connectionManager = connectionManager; this.connectionManager = scmConnectionManager;
return this; return this;
} }
/** /**
* Sets the Context. * Sets the Context.
* *
* @param context - StateContext * @param stateContext - StateContext
* @return this * @return this
*/ */
public Builder setContext(StateContext context) { public Builder setContext(StateContext stateContext) {
Preconditions.checkNotNull(context); Preconditions.checkNotNull(stateContext);
this.context = context; this.context = stateContext;
return this; return this;
} }

View File

@ -92,32 +92,32 @@ public Long get() {
/** /**
* Sets the value of this metric. * Sets the value of this metric.
* *
* @param value - value of the metric. * @param setValue - value of the metric.
*/ */
@Override @Override
public void set(Long value) { public void set(Long setValue) {
this.value = value; this.value = setValue;
} }
/** /**
* Adds a value of to the base. * Adds a value of to the base.
* *
* @param value - value * @param addValue - value
*/ */
@Override @Override
public void add(Long value) { public void add(Long addValue) {
this.value += value; this.value += addValue;
} }
/** /**
* subtract a value. * subtract a value.
* *
* @param value value * @param subValue value
*/ */
@Override @Override
public void subtract(Long value) { public void subtract(Long subValue) {
this.value -= value; this.value -= subValue;
} }
/** /**

View File

@ -73,26 +73,26 @@ public LongMetric getRemaining() {
/** /**
* Set the capacity, used and remaining space on a datanode. * Set the capacity, used and remaining space on a datanode.
* *
* @param capacity in bytes * @param newCapacity in bytes
* @param used in bytes * @param newUsed in bytes
* @param remaining in bytes * @param newRemaining in bytes
*/ */
@VisibleForTesting @VisibleForTesting
public void set(long capacity, long used, long remaining) { public void set(long newCapacity, long newUsed, long newRemaining) {
Preconditions.checkNotNull(capacity, "Capacity cannot be null"); Preconditions.checkNotNull(newCapacity, "Capacity cannot be null");
Preconditions.checkNotNull(used, "used cannot be null"); Preconditions.checkNotNull(newUsed, "used cannot be null");
Preconditions.checkNotNull(remaining, "remaining cannot be null"); Preconditions.checkNotNull(newRemaining, "remaining cannot be null");
Preconditions.checkArgument(capacity >= 0, "Capacity cannot be " + Preconditions.checkArgument(newCapacity >= 0, "Capacity cannot be " +
"negative."); "negative.");
Preconditions.checkArgument(used >= 0, "used space cannot be " + Preconditions.checkArgument(newUsed >= 0, "used space cannot be " +
"negative."); "negative.");
Preconditions.checkArgument(remaining >= 0, "remaining cannot be " + Preconditions.checkArgument(newRemaining >= 0, "remaining cannot be " +
"negative"); "negative");
this.capacity = new LongMetric(capacity); this.capacity = new LongMetric(newCapacity);
this.scmUsed = new LongMetric(used); this.scmUsed = new LongMetric(newUsed);
this.remaining = new LongMetric(remaining); this.remaining = new LongMetric(newRemaining);
} }
/** /**

View File

@ -83,7 +83,7 @@ public static void shutdown() throws InterruptedException {
if (cluster != null) { if (cluster != null) {
cluster.shutdown(); cluster.shutdown();
} }
IOUtils.cleanup(null, storageContainerLocationClient, cluster); IOUtils.cleanupWithLogger(null, storageContainerLocationClient, cluster);
} }
/** /**

View File

@ -90,7 +90,7 @@ public static void shutdown() throws InterruptedException {
if (cluster != null) { if (cluster != null) {
cluster.shutdown(); cluster.shutdown();
} }
IOUtils.cleanup(null, storageContainerLocationClient, cluster); IOUtils.cleanupWithLogger(null, storageContainerLocationClient, cluster);
} }
/** /**

View File

@ -96,7 +96,7 @@ public static void shutdown() throws InterruptedException {
if (cluster != null) { if (cluster != null) {
cluster.shutdown(); cluster.shutdown();
} }
IOUtils.cleanup(null, storageContainerLocationClient, cluster); IOUtils.cleanupWithLogger(null, storageContainerLocationClient, cluster);
} }
/** /**

View File

@ -169,10 +169,10 @@ private void sleepIfNeeded() {
@Override @Override
public StorageContainerDatanodeProtocolProtos.SCMHeartbeatResponseProto public StorageContainerDatanodeProtocolProtos.SCMHeartbeatResponseProto
sendHeartbeat(DatanodeID datanodeID, SCMNodeReport nodeReport, sendHeartbeat(DatanodeID datanodeID, SCMNodeReport nodeReport,
ReportState reportState) throws IOException { ReportState scmReportState) throws IOException {
rpcCount.incrementAndGet(); rpcCount.incrementAndGet();
heartbeatCount.incrementAndGet(); heartbeatCount.incrementAndGet();
this.reportState = reportState; this.reportState = scmReportState;
sleepIfNeeded(); sleepIfNeeded();
List<SCMCommandResponseProto> List<SCMCommandResponseProto>
cmdResponses = new LinkedList<>(); cmdResponses = new LinkedList<>();

View File

@ -29,6 +29,9 @@
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* Test Ozone Bucket Info operation.
*/
public class TestBucketInfo { public class TestBucketInfo {
@Test @Test
public void testBucketInfoJson() throws IOException { public void testBucketInfoJson() throws IOException {

View File

@ -25,6 +25,9 @@
import static junit.framework.TestCase.assertEquals; import static junit.framework.TestCase.assertEquals;
import static org.apache.hadoop.ozone.web.utils.OzoneUtils.getRequestID; import static org.apache.hadoop.ozone.web.utils.OzoneUtils.getRequestID;
/**
* Test Ozone Error Codes.
*/
public class TestErrorCode { public class TestErrorCode {
/** /**
* Test Error Generator functions. * Test Error Generator functions.

View File

@ -46,6 +46,9 @@
import static org.apache.hadoop.ozone.web.utils.OzoneUtils.getRequestID; import static org.apache.hadoop.ozone.web.utils.OzoneUtils.getRequestID;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* Test Ozone Access through REST protocol.
*/
public class TestOzoneWebAccess { public class TestOzoneWebAccess {
/** /**
* Set the timeout for every test. * Set the timeout for every test.

View File

@ -29,7 +29,9 @@
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
/**
* Test Ozone Volume Quota.
*/
public class TestQuota { public class TestQuota {
@Test @Test
public void testParseQuota() { public void testParseQuota() {

View File

@ -29,6 +29,9 @@
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
/**
* Test Ozone Utility operations like verifying resource name.
*/
public class TestUtils { public class TestUtils {
/** /**

View File

@ -28,6 +28,9 @@
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
/**
* Test Ozone Volume info structure.
*/
public class TestVolumeStructs { public class TestVolumeStructs {
@Test @Test

View File

@ -44,7 +44,9 @@
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
/**
* Test Ozone Bucket Lifecycle.
*/
public class TestBuckets { public class TestBuckets {
/** /**
* Set the timeout for every test. * Set the timeout for every test.

View File

@ -74,6 +74,9 @@
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
/**
* Test Ozone Key Lifecycle.
*/
public class TestKeys { public class TestKeys {
/** /**
* Set the timeout for every test. * Set the timeout for every test.

View File

@ -58,6 +58,9 @@
import static org.mockito.Mockito.times; import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
/**
* Test Ozone Volumes Lifecycle.
*/
public class TestVolume { public class TestVolume {
private static MiniOzoneCluster cluster = null; private static MiniOzoneCluster cluster = null;
private static OzoneRestClient ozoneRestClient = null; private static OzoneRestClient ozoneRestClient = null;

View File

@ -21,7 +21,7 @@
/** /**
* Constants for Ozone FileSystem implementation. * Constants for Ozone FileSystem implementation.
*/ */
public class Constants { public final class Constants {
public static final String OZONE_URI_SCHEME = "o3"; public static final String OZONE_URI_SCHEME = "o3";

View File

@ -48,7 +48,7 @@ class OzoneContract extends AbstractFSContract {
private static StorageHandler storageHandler; private static StorageHandler storageHandler;
private static final String CONTRACT_XML = "contract/ozone.xml"; private static final String CONTRACT_XML = "contract/ozone.xml";
public OzoneContract(Configuration conf) { OzoneContract(Configuration conf) {
super(conf); super(conf);
//insert the base features //insert the base features
addConfResource(CONTRACT_XML); addConfResource(CONTRACT_XML);