HBASE-23627 Resolved remaining Checkstyle violations in hbase-thrift
Signed-off-by: Viraj Jasani <vjasani@apache.org> Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
17652a7b32
commit
a18a5c4baa
|
@ -15,7 +15,6 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.apache.hadoop.hbase.thrift;
|
package org.apache.hadoop.hbase.thrift;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -35,7 +34,6 @@ import org.apache.hadoop.hbase.thrift.generated.TIncrement;
|
||||||
import org.apache.hadoop.hbase.util.Bytes;
|
import org.apache.hadoop.hbase.util.Bytes;
|
||||||
import org.apache.hadoop.hbase.util.Threads;
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.apache.hadoop.metrics2.util.MBeans;
|
import org.apache.hadoop.metrics2.util.MBeans;
|
||||||
import org.apache.thrift.TException;
|
|
||||||
import org.apache.yetus.audience.InterfaceAudience;
|
import org.apache.yetus.audience.InterfaceAudience;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -51,7 +49,6 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class IncrementCoalescer implements IncrementCoalescerMBean {
|
public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to identify a cell that will be incremented.
|
* Used to identify a cell that will be incremented.
|
||||||
*
|
*
|
||||||
|
@ -82,10 +79,6 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
return rowKey;
|
return rowKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRowKey(byte[] rowKey) {
|
|
||||||
this.rowKey = rowKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] getFamily() {
|
public byte[] getFamily() {
|
||||||
return family;
|
return family;
|
||||||
}
|
}
|
||||||
|
@ -119,13 +112,19 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
if (obj == null) return false;
|
if (obj == null) return false;
|
||||||
if (getClass() != obj.getClass()) return false;
|
if (getClass() != obj.getClass()) return false;
|
||||||
FullyQualifiedRow other = (FullyQualifiedRow) obj;
|
FullyQualifiedRow other = (FullyQualifiedRow) obj;
|
||||||
if (!Arrays.equals(family, other.family)) return false;
|
|
||||||
if (!Arrays.equals(qualifier, other.qualifier)) return false;
|
if (!Arrays.equals(family, other.family)) {
|
||||||
if (!Arrays.equals(rowKey, other.rowKey)) return false;
|
return false;
|
||||||
if (!Arrays.equals(table, other.table)) return false;
|
}
|
||||||
return true;
|
if (!Arrays.equals(qualifier, other.qualifier)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Arrays.equals(rowKey, other.rowKey)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Arrays.equals(table, other.table);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final LongAdder failedIncrements = new LongAdder();
|
private final LongAdder failedIncrements = new LongAdder();
|
||||||
|
@ -139,9 +138,8 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
private int maxQueueSize = 500000;
|
private int maxQueueSize = 500000;
|
||||||
private static final int CORE_POOL_SIZE = 1;
|
private static final int CORE_POOL_SIZE = 1;
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(FullyQualifiedRow.class);
|
private static final Logger LOG = LoggerFactory.getLogger(IncrementCoalescer.class);
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
public IncrementCoalescer(ThriftHBaseServiceHandler hand) {
|
public IncrementCoalescer(ThriftHBaseServiceHandler hand) {
|
||||||
this.handler = hand;
|
this.handler = hand;
|
||||||
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
|
LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
|
||||||
|
@ -151,7 +149,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
MBeans.register("thrift", "Thrift", this);
|
MBeans.register("thrift", "Thrift", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean queueIncrement(TIncrement inc) throws TException {
|
public boolean queueIncrement(TIncrement inc) {
|
||||||
if (!canQueue()) {
|
if (!canQueue()) {
|
||||||
failedIncrements.increment();
|
failedIncrements.increment();
|
||||||
return false;
|
return false;
|
||||||
|
@ -159,7 +157,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
return internalQueueTincrement(inc);
|
return internalQueueTincrement(inc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean queueIncrements(List<TIncrement> incs) throws TException {
|
public boolean queueIncrements(List<TIncrement> incs) {
|
||||||
if (!canQueue()) {
|
if (!canQueue()) {
|
||||||
failedIncrements.increment();
|
failedIncrements.increment();
|
||||||
return false;
|
return false;
|
||||||
|
@ -172,7 +170,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean internalQueueTincrement(TIncrement inc) throws TException {
|
private boolean internalQueueTincrement(TIncrement inc) {
|
||||||
byte[][] famAndQf = CellUtil.parseColumn(inc.getColumn());
|
byte[][] famAndQf = CellUtil.parseColumn(inc.getColumn());
|
||||||
if (famAndQf.length != 2) return false;
|
if (famAndQf.length != 2) return false;
|
||||||
|
|
||||||
|
@ -182,7 +180,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
|
|
||||||
@SuppressWarnings("FutureReturnValueIgnored")
|
@SuppressWarnings("FutureReturnValueIgnored")
|
||||||
private boolean internalQueueIncrement(byte[] tableName, byte[] rowKey, byte[] fam,
|
private boolean internalQueueIncrement(byte[] tableName, byte[] rowKey, byte[] fam,
|
||||||
byte[] qual, long ammount) throws TException {
|
byte[] qual, long ammount) {
|
||||||
int countersMapSize = countersMap.size();
|
int countersMapSize = countersMap.size();
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,7 +197,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
Long value = countersMap.remove(key);
|
Long value = countersMap.remove(key);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
// There was nothing there, create a new value
|
// There was nothing there, create a new value
|
||||||
value = Long.valueOf(currentAmount);
|
value = currentAmount;
|
||||||
} else {
|
} else {
|
||||||
value += currentAmount;
|
value += currentAmount;
|
||||||
successfulCoalescings.increment();
|
successfulCoalescings.increment();
|
||||||
|
@ -232,9 +230,7 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Callable<Integer> createIncCallable() {
|
private Callable<Integer> createIncCallable() {
|
||||||
return new Callable<Integer>() {
|
return () -> {
|
||||||
@Override
|
|
||||||
public Integer call() throws Exception {
|
|
||||||
int failures = 0;
|
int failures = 0;
|
||||||
Set<FullyQualifiedRow> keys = countersMap.keySet();
|
Set<FullyQualifiedRow> keys = countersMap.keySet();
|
||||||
for (FullyQualifiedRow row : keys) {
|
for (FullyQualifiedRow row : keys) {
|
||||||
|
@ -264,7 +260,6 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return failures;
|
return failures;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,5 +364,4 @@ public class IncrementCoalescer implements IncrementCoalescerMBean {
|
||||||
public long getCountersMapSize() {
|
public long getCountersMapSize() {
|
||||||
return countersMap.size();
|
return countersMap.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.hadoop.hbase.security.HBaseKerberosUtils;
|
||||||
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.LargeTests;
|
import org.apache.hadoop.hbase.testclassification.LargeTests;
|
||||||
import org.apache.hadoop.hbase.thrift.generated.Hbase;
|
import org.apache.hadoop.hbase.thrift.generated.Hbase;
|
||||||
import org.apache.hadoop.hbase.util.TableDescriptorChecker;
|
|
||||||
import org.apache.hadoop.security.authentication.util.KerberosName;
|
import org.apache.hadoop.security.authentication.util.KerberosName;
|
||||||
import org.apache.http.HttpHeaders;
|
import org.apache.http.HttpHeaders;
|
||||||
import org.apache.http.auth.AuthSchemeProvider;
|
import org.apache.http.auth.AuthSchemeProvider;
|
||||||
|
@ -212,9 +211,7 @@ public class TestThriftSpnegoHttpFallbackServer extends TestThriftHttpServer {
|
||||||
// The name of the principal
|
// The name of the principal
|
||||||
final String clientPrincipalName = clientPrincipals.iterator().next().getName();
|
final String clientPrincipalName = clientPrincipals.iterator().next().getName();
|
||||||
|
|
||||||
return Subject.doAs(clientSubject, new PrivilegedExceptionAction<CloseableHttpClient>() {
|
return Subject.doAs(clientSubject, (PrivilegedExceptionAction<CloseableHttpClient>) () -> {
|
||||||
@Override
|
|
||||||
public CloseableHttpClient run() throws Exception {
|
|
||||||
// Logs in with Kerberos via GSS
|
// Logs in with Kerberos via GSS
|
||||||
GSSManager gssManager = GSSManager.getInstance();
|
GSSManager gssManager = GSSManager.getInstance();
|
||||||
// jGSS Kerberos login constant
|
// jGSS Kerberos login constant
|
||||||
|
@ -234,7 +231,6 @@ public class TestThriftSpnegoHttpFallbackServer extends TestThriftHttpServer {
|
||||||
.setDefaultAuthSchemeRegistry(authRegistry)
|
.setDefaultAuthSchemeRegistry(authRegistry)
|
||||||
.setDefaultCredentialsProvider(credentialsProvider)
|
.setDefaultCredentialsProvider(credentialsProvider)
|
||||||
.build();
|
.build();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.apache.hadoop.hbase.security.HBaseKerberosUtils;
|
||||||
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.LargeTests;
|
import org.apache.hadoop.hbase.testclassification.LargeTests;
|
||||||
import org.apache.hadoop.hbase.thrift.generated.Hbase;
|
import org.apache.hadoop.hbase.thrift.generated.Hbase;
|
||||||
import org.apache.hadoop.hbase.util.TableDescriptorChecker;
|
|
||||||
import org.apache.hadoop.security.authentication.util.KerberosName;
|
import org.apache.hadoop.security.authentication.util.KerberosName;
|
||||||
import org.apache.http.HttpHeaders;
|
import org.apache.http.HttpHeaders;
|
||||||
import org.apache.http.auth.AuthSchemeProvider;
|
import org.apache.http.auth.AuthSchemeProvider;
|
||||||
|
@ -211,9 +210,7 @@ public class TestThriftSpnegoHttpServer extends TestThriftHttpServer {
|
||||||
// The name of the principal
|
// The name of the principal
|
||||||
final String clientPrincipalName = clientPrincipals.iterator().next().getName();
|
final String clientPrincipalName = clientPrincipals.iterator().next().getName();
|
||||||
|
|
||||||
return Subject.doAs(clientSubject, new PrivilegedExceptionAction<CloseableHttpClient>() {
|
return Subject.doAs(clientSubject, (PrivilegedExceptionAction<CloseableHttpClient>) () -> {
|
||||||
@Override
|
|
||||||
public CloseableHttpClient run() throws Exception {
|
|
||||||
// Logs in with Kerberos via GSS
|
// Logs in with Kerberos via GSS
|
||||||
GSSManager gssManager = GSSManager.getInstance();
|
GSSManager gssManager = GSSManager.getInstance();
|
||||||
// jGSS Kerberos login constant
|
// jGSS Kerberos login constant
|
||||||
|
@ -233,7 +230,6 @@ public class TestThriftSpnegoHttpServer extends TestThriftHttpServer {
|
||||||
.setDefaultAuthSchemeRegistry(authRegistry)
|
.setDefaultAuthSchemeRegistry(authRegistry)
|
||||||
.setDefaultCredentialsProvider(credentialsProvider)
|
.setDefaultCredentialsProvider(credentialsProvider)
|
||||||
.build();
|
.build();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue