HBASE-20744 Address FindBugs warnings in branch-1

minor fix

Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
Xu Cang 2018-07-22 23:40:17 -07:00 committed by tedyu
parent dfc7ecd9ca
commit 3a97976eae
3 changed files with 9 additions and 16 deletions

View File

@ -255,7 +255,7 @@ public class EncodedDataBlock {
}
BufferGrabbingByteArrayOutputStream stream = new BufferGrabbingByteArrayOutputStream();
baos.writeTo(stream);
this.dataBlockEncoder.endBlockEncoding(encodingCtx, out, stream.ourBytes);
this.dataBlockEncoder.endBlockEncoding(encodingCtx, out, stream.getOurBytes());
} catch (IOException e) {
throw new RuntimeException(String.format(
"Bug in encoding part of algorithm %s. " +
@ -268,6 +268,10 @@ public class EncodedDataBlock {
private static class BufferGrabbingByteArrayOutputStream extends ByteArrayOutputStream {
private byte[] ourBytes;
private synchronized byte[] getOurBytes() {
return ourBytes;
}
@Override
public synchronized void write(byte[] b, int off, int len) {
this.ourBytes = b;

View File

@ -48,7 +48,7 @@ public class MetricsExecutorImpl implements MetricsExecutor {
private enum ExecutorSingleton {
INSTANCE;
private final ScheduledExecutorService scheduler = new ScheduledThreadPoolExecutor(1,
private final transient ScheduledExecutorService scheduler = new ScheduledThreadPoolExecutor(1,
new ThreadPoolExecutorThreadFactory("HBase-Metrics2-"));
}

View File

@ -190,21 +190,10 @@ public class RegionServerQuotaManager {
+ e.getMessage());
// Depending on whether we are supposed to throw a retryable IO exeption or not, choose
// the correct exception type to (re)throw
if (e instanceof ThrottlingException) {
if (useRetryableThrottlingException) {
throw new RpcThrottlingException(e.getMessage());
} else {
throw e;
}
} else if (e instanceof RpcThrottlingException) {
if (useRetryableThrottlingException) {
throw e;
} else {
throw new ThrottlingException(e.getMessage());
}
} else {
LOG.warn("Unexpected exception from quota check", e);
if (useRetryableThrottlingException) {
throw e;
} else {
throw new ThrottlingException(e.getMessage());
}
}
return quota;