HDDS-137. Cleanup Hdds-ozone CheckStyle Issues.
Contributed by Anu Engineer.
This commit is contained in:
parent
6b21a599fb
commit
19560bb704
|
@ -285,7 +285,8 @@ public class ContainerData {
|
||||||
*
|
*
|
||||||
* @return String Name.
|
* @return String Name.
|
||||||
*/
|
*/
|
||||||
// TODO: check the ContainerCache class to see if we are using the ContainerID instead.
|
// TODO: check the ContainerCache class to see if
|
||||||
|
// we are using the ContainerID instead.
|
||||||
/*
|
/*
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return getContainerID();
|
return getContainerID();
|
||||||
|
|
|
@ -314,7 +314,8 @@ public class ContainerManagerImpl implements ContainerManager {
|
||||||
writeLock();
|
writeLock();
|
||||||
try {
|
try {
|
||||||
if (containerMap.containsKey(containerData.getContainerID())) {
|
if (containerMap.containsKey(containerData.getContainerID())) {
|
||||||
LOG.debug("container already exists. {}", containerData.getContainerID());
|
LOG.debug("container already exists. {}",
|
||||||
|
containerData.getContainerID());
|
||||||
throw new StorageContainerException("container already exists.",
|
throw new StorageContainerException("container already exists.",
|
||||||
CONTAINER_EXISTS);
|
CONTAINER_EXISTS);
|
||||||
}
|
}
|
||||||
|
@ -595,7 +596,8 @@ public class ContainerManagerImpl implements ContainerManager {
|
||||||
@Override
|
@Override
|
||||||
public void updateContainer(long containerID, ContainerData data,
|
public void updateContainer(long containerID, ContainerData data,
|
||||||
boolean forceUpdate) throws StorageContainerException {
|
boolean forceUpdate) throws StorageContainerException {
|
||||||
Preconditions.checkState(containerID >= 0, "Container ID cannot be negative.");
|
Preconditions.checkState(containerID >= 0,
|
||||||
|
"Container ID cannot be negative.");
|
||||||
Preconditions.checkNotNull(data, "Container data cannot be null");
|
Preconditions.checkNotNull(data, "Container data cannot be null");
|
||||||
FileOutputStream containerStream = null;
|
FileOutputStream containerStream = null;
|
||||||
DigestOutputStream dos = null;
|
DigestOutputStream dos = null;
|
||||||
|
@ -711,7 +713,7 @@ public class ContainerManagerImpl implements ContainerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns LifeCycle State of the container
|
* Returns LifeCycle State of the container.
|
||||||
* @param containerID - Id of the container
|
* @param containerID - Id of the container
|
||||||
* @return LifeCycle State of the container
|
* @return LifeCycle State of the container
|
||||||
* @throws StorageContainerException
|
* @throws StorageContainerException
|
||||||
|
|
|
@ -72,8 +72,10 @@ public class KeyManagerImpl implements KeyManager {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void putKey(KeyData data) throws IOException {
|
public void putKey(KeyData data) throws IOException {
|
||||||
Preconditions.checkNotNull(data, "KeyData cannot be null for put operation.");
|
Preconditions.checkNotNull(data,
|
||||||
Preconditions.checkState(data.getContainerID() >= 0, "Container ID cannot be negative");
|
"KeyData cannot be null for put operation.");
|
||||||
|
Preconditions.checkState(data.getContainerID() >= 0,
|
||||||
|
"Container ID cannot be negative");
|
||||||
containerManager.readLock();
|
containerManager.readLock();
|
||||||
try {
|
try {
|
||||||
// We are not locking the key manager since LevelDb serializes all actions
|
// We are not locking the key manager since LevelDb serializes all actions
|
||||||
|
@ -169,8 +171,10 @@ public class KeyManagerImpl implements KeyManager {
|
||||||
public List<KeyData> listKey(
|
public List<KeyData> listKey(
|
||||||
long containerID, long startLocalID, int count)
|
long containerID, long startLocalID, int count)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Preconditions.checkState(containerID >= 0, "Container ID cannot be negative");
|
Preconditions.checkState(containerID >= 0,
|
||||||
Preconditions.checkState(startLocalID >= 0, "startLocal ID cannot be negative");
|
"Container ID cannot be negative");
|
||||||
|
Preconditions.checkState(startLocalID >= 0,
|
||||||
|
"startLocal ID cannot be negative");
|
||||||
Preconditions.checkArgument(count > 0,
|
Preconditions.checkArgument(count > 0,
|
||||||
"Count must be a positive number.");
|
"Count must be a positive number.");
|
||||||
ContainerData cData = containerManager.readContainer(containerID);
|
ContainerData cData = containerManager.readContainer(containerID);
|
||||||
|
|
|
@ -265,7 +265,8 @@ public class ContainerStateMachine extends BaseStateMachine {
|
||||||
Message message = runCommand(requestProto);
|
Message message = runCommand(requestProto);
|
||||||
if (cmdType == ContainerProtos.Type.CreateContainer) {
|
if (cmdType == ContainerProtos.Type.CreateContainer) {
|
||||||
long containerID =
|
long containerID =
|
||||||
requestProto.getCreateContainer().getContainerData().getContainerID();
|
requestProto.getCreateContainer()
|
||||||
|
.getContainerData().getContainerID();
|
||||||
createContainerFutureMap.remove(containerID).complete(message);
|
createContainerFutureMap.remove(containerID).complete(message);
|
||||||
}
|
}
|
||||||
return CompletableFuture.completedFuture(message);
|
return CompletableFuture.completedFuture(message);
|
||||||
|
|
|
@ -125,7 +125,8 @@ public final class ContainerCache extends LRUMap {
|
||||||
*/
|
*/
|
||||||
public MetadataStore getDB(long containerID, String containerDBPath)
|
public MetadataStore getDB(long containerID, String containerDBPath)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Preconditions.checkState(containerID >= 0, "Container ID cannot be negative.");
|
Preconditions.checkState(containerID >= 0,
|
||||||
|
"Container ID cannot be negative.");
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
MetadataStore db = (MetadataStore) this.get(containerID);
|
MetadataStore db = (MetadataStore) this.get(containerID);
|
||||||
|
@ -153,7 +154,8 @@ public final class ContainerCache extends LRUMap {
|
||||||
* @param containerID - ID of the container.
|
* @param containerID - ID of the container.
|
||||||
*/
|
*/
|
||||||
public void removeDB(long containerID) {
|
public void removeDB(long containerID) {
|
||||||
Preconditions.checkState(containerID >= 0, "Container ID cannot be negative.");
|
Preconditions.checkState(containerID >= 0,
|
||||||
|
"Container ID cannot be negative.");
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
MetadataStore db = (MetadataStore)this.get(containerID);
|
MetadataStore db = (MetadataStore)this.get(containerID);
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* SCM Testing and Mocking Utils.
|
||||||
|
*/
|
||||||
|
package org.apache.hadoop.ozone.container.common;
|
Loading…
Reference in New Issue