Skip to content

Commit

Permalink
HBASE-12887 Cleanup many checkstyle errors in o.a.h.h.client
Browse files Browse the repository at this point in the history
  • Loading branch information
ndimiduk committed Jan 20, 2015
1 parent 3e77789 commit 9bdb81f
Show file tree
Hide file tree
Showing 33 changed files with 267 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
*/
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class InterfaceAudience {
public final class InterfaceAudience {
/**
* Intended for use by any project or application.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
* It delegates to the Standard Doclet, and takes the same options.
*/
@InterfaceAudience.Private
public class ExcludePrivateAnnotationsStandardDoclet {
public final class ExcludePrivateAnnotationsStandardDoclet {

private ExcludePrivateAnnotationsStandardDoclet() {}

public static LanguageVersion languageVersion() {
return LanguageVersion.JAVA_1_5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
* It delegates to the Standard Doclet, and takes the same options.
*/
@InterfaceAudience.Private
public class IncludePublicAnnotationsStandardDoclet {
public final class IncludePublicAnnotationsStandardDoclet {

private IncludePublicAnnotationsStandardDoclet() {}

public static LanguageVersion languageVersion() {
return LanguageVersion.JAVA_1_5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
* <p>
* Based on code from http://www.sixlegs.com/blog/java/exclude-javadoc-tag.html.
*/
class RootDocProcessor {
final class RootDocProcessor {

static String stability = StabilityOptions.UNSTABLE_OPTION;
static boolean treatUnannotatedClassesAsPrivate = false;

private RootDocProcessor() {}

public static RootDoc process(RootDoc root) {
return (RootDoc) process(root, RootDoc.class);
}
Expand Down Expand Up @@ -215,7 +217,9 @@ private static Object[] filter(Doc[] array, Class<?> componentType) {
}

private Object unwrap(Object proxy) {
if (proxy instanceof Proxy) return ((ExcludeHandler) Proxy.getInvocationHandler(proxy)).target;
if (proxy instanceof Proxy) {
return ((ExcludeHandler) Proxy.getInvocationHandler(proxy)).target;
}
return proxy;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import java.util.ArrayList;
import java.util.List;

class StabilityOptions {
final class StabilityOptions {

private StabilityOptions() {}

public static final String STABLE_OPTION = "-stable";
public static final String EVOLVING_OPTION = "-evolving";
public static final String UNSTABLE_OPTION = "-unstable";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static interface AsyncRequestFuture {

/** Return value from a submit that didn't contain any requests. */
private static final AsyncRequestFuture NO_REQS_RESULT = new AsyncRequestFuture() {
public final Object[] result = new Object[0];
final Object[] result = new Object[0];
@Override
public boolean hasError() { return false; }
@Override
Expand Down Expand Up @@ -243,7 +243,8 @@ public synchronized void merge(BatchErrors other) {
}

public AsyncProcess(ClusterConnection hc, Configuration conf, ExecutorService pool,
RpcRetryingCallerFactory rpcCaller, boolean useGlobalErrors, RpcControllerFactory rpcFactory) {
RpcRetryingCallerFactory rpcCaller, boolean useGlobalErrors,
RpcControllerFactory rpcFactory) {
if (hc == null) {
throw new IllegalArgumentException("HConnection cannot be null.");
}
Expand Down Expand Up @@ -311,7 +312,7 @@ private ExecutorService getPool(ExecutorService pool) {
}

/**
* See {@link #submit(ExecutorService, TableName, List, boolean, org.apache.hadoop.hbase.client.coprocessor.Batch.Callback, boolean)}.
* See {@link #submit(ExecutorService, TableName, List, boolean, Batch.Callback, boolean)}.
* Uses default ExecutorService for this AP (must have been created with one).
*/
public <CResult> AsyncRequestFuture submit(TableName tableName, List<? extends Row> rows,
Expand Down Expand Up @@ -514,7 +515,7 @@ protected boolean canTakeOperation(HRegionLocation loc,
}

/**
* See {@link #submitAll(ExecutorService, TableName, List, org.apache.hadoop.hbase.client.coprocessor.Batch.Callback, Object[])}.
* See {@link #submitAll(ExecutorService, TableName, List, Batch.Callback, Object[])}.
* Uses default ExecutorService for this AP (must have been created with one).
*/
public <CResult> AsyncRequestFuture submitAll(TableName tableName,
Expand Down Expand Up @@ -1345,11 +1346,11 @@ private void setResult(Action<Row> action, Object result) {
if (results == null) {
decActionCounter(index);
return; // Simple case, no replica requests.
} else if ((state = trySetResultSimple(
index, action.getAction(), false, result, null, isStale)) == null) {
}
state = trySetResultSimple(index, action.getAction(), false, result, null, isStale);
if (state == null) {
return; // Simple case, no replica requests.
}
assert state != null;
// At this point we know that state is set to replica tracking class.
// It could be that someone else is also looking at it; however, we know there can
// only be one state object, and only one thread can set callCount to 0. Other threads
Expand Down Expand Up @@ -1385,11 +1386,11 @@ private void setError(int index, Row row, Throwable throwable, ServerName server
errors.add(throwable, row, server);
decActionCounter(index);
return; // Simple case, no replica requests.
} else if ((state = trySetResultSimple(
index, row, true, throwable, server, false)) == null) {
}
state = trySetResultSimple(index, row, true, throwable, server, false);
if (state == null) {
return; // Simple case, no replica requests.
}
assert state != null;
BatchErrors target = null; // Error will be added to final errors, or temp replica errors.
boolean isActionDone = false;
synchronized (state) {
Expand Down Expand Up @@ -1455,7 +1456,8 @@ private ReplicaResultState trySetResultSimple(int index, Row row, boolean isErro
results[index] = result;
} else {
synchronized (replicaResultLock) {
if ((resObj = results[index]) == null) {
resObj = results[index];
if (resObj == null) {
if (isFromReplica) {
throw new AssertionError("Unexpected stale result for " + row);
}
Expand Down Expand Up @@ -1720,7 +1722,8 @@ private static boolean isReplicaGet(Row row) {
}

/**
* For manageError. Only used to make logging more clear, we don't actually care why we don't retry.
* For {@link AsyncRequestFutureImpl#manageError(int, Row, Retry, Throwable, ServerName)}. Only
* used to make logging more clear, we don't actually care why we don't retry.
*/
private enum Retry {
YES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
* such as an IP address, PID, and composite deterministic ID.
*/
@InterfaceAudience.Private
class ClientIdGenerator {
final class ClientIdGenerator {
static final Log LOG = LogFactory.getLog(ClientIdGenerator.class);

private ClientIdGenerator() {}

/**
* @return a unique ID incorporating IP address, PID, TID and timer. Might be an overkill...
* Note though that new UUID in java by default is just a random number.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,12 @@ public void close() {
// We used to catch this error, interpret, and rethrow. However, we
// have since decided that it's not nice for a scanner's close to
// throw exceptions. Chances are it was just due to lease time out.
if (LOG.isDebugEnabled()) {
LOG.debug("scanner failed to close", e);
}
} catch (IOException e) {
/* An exception other than UnknownScanner is unexpected. */
LOG.warn("scanner failed to close. Exception follows: " + e);
/* An exception other than UnknownScanner is unexpected. */
LOG.warn("scanner failed to close.", e);
}
callable = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public ClientSmallReversedScanner(final Configuration conf, final Scan scan,
final TableName tableName, ClusterConnection connection,
RpcRetryingCallerFactory rpcFactory, RpcControllerFactory controllerFactory,
ExecutorService pool, int primaryOperationTimeout) throws IOException {
super(conf, scan, tableName, connection, rpcFactory, controllerFactory, pool, primaryOperationTimeout);
super(conf, scan, tableName, connection, rpcFactory, controllerFactory, pool,
primaryOperationTimeout);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
// classes and unit tests only.
public interface ClusterConnection extends HConnection {

/** @return - true if the master server is running
* @deprecated this has been deprecated without a replacement */
/**
* @return - true if the master server is running
* @deprecated this has been deprecated without a replacement
*/
@Override
@Deprecated
boolean isMasterRunning()
Expand Down Expand Up @@ -194,8 +196,8 @@ RegionLocations locateRegion(TableName tableName,
* @return region locations for this row.
* @throws IOException
*/
RegionLocations locateRegion(TableName tableName,
byte[] row, boolean useCache, boolean retry, int replicaId) throws IOException;
RegionLocations locateRegion(TableName tableName, byte[] row, boolean useCache, boolean retry,
int replicaId) throws IOException;

/**
* Returns a {@link MasterKeepAliveConnection} to the active master
Expand Down Expand Up @@ -250,6 +252,7 @@ HRegionLocation getRegionLocation(TableName tableName, byte [] row,
* connection.
* @return The shared instance. Never returns null.
* @throws MasterNotRunningException
* @deprecated Since 0.96.0
*/
@Override
@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.Inet6Address;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
Expand Down
Loading

0 comments on commit 9bdb81f

Please sign in to comment.