HBASE-24174 Fix findbugs warning on ServiceAuthorizationManager (#1494)
Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
d4b64c2545
commit
1eeff370c4
|
@ -2202,7 +2202,6 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
|||
final InetSocketAddress bindAddress, Configuration conf,
|
||||
RpcScheduler scheduler)
|
||||
throws IOException {
|
||||
|
||||
if (conf.getBoolean("hbase.ipc.server.reservoir.enabled", true)) {
|
||||
this.reservoir = new BoundedByteBufferPool(
|
||||
conf.getInt("hbase.ipc.server.reservoir.max.buffer.size", 1024 * 1024),
|
||||
|
@ -2265,14 +2264,9 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
|||
if (scheduler instanceof ConfigurationObserver) {
|
||||
((ConfigurationObserver)scheduler).onConfigurationChange(newConf);
|
||||
}
|
||||
// Make sure authManager will read hbase-policy file
|
||||
System.setProperty("hadoop.policy.file", "hbase-policy.xml");
|
||||
synchronized (authManager) {
|
||||
authManager.refresh(newConf, new HBasePolicyProvider());
|
||||
if (authorize) {
|
||||
refreshAuthManager(newConf, new HBasePolicyProvider());
|
||||
}
|
||||
LOG.info("Refreshed hbase-policy.xml successfully");
|
||||
ProxyUsers.refreshSuperUserGroupsConfiguration(newConf);
|
||||
LOG.info("Refreshed super and proxy users successfully");
|
||||
}
|
||||
|
||||
private void initReconfigurable(Configuration confToLoad) {
|
||||
|
@ -2353,10 +2347,14 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void refreshAuthManager(PolicyProvider pp) {
|
||||
public synchronized void refreshAuthManager(Configuration conf, PolicyProvider pp) {
|
||||
// Ignore warnings that this should be accessed in a static way instead of via an instance;
|
||||
// it'll break if you go via static route.
|
||||
this.authManager.refresh(this.conf, pp);
|
||||
System.setProperty("hadoop.policy.file", "hbase-policy.xml");
|
||||
this.authManager.refresh(conf, pp);
|
||||
LOG.info("Refreshed hbase-policy.xml successfully");
|
||||
ProxyUsers.refreshSuperUserGroupsConfiguration(conf);
|
||||
LOG.info("Refreshed super and proxy users successfully");
|
||||
}
|
||||
|
||||
private AuthenticationTokenSecretManager createSecretManager() {
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.apache.hadoop.hbase.ipc;
|
|||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.hbase.classification.InterfaceStability;
|
||||
import org.apache.hadoop.hbase.CellScanner;
|
||||
|
@ -78,10 +79,11 @@ public interface RpcServerInterface {
|
|||
|
||||
/**
|
||||
* Refresh authentication manager policy.
|
||||
* @param conf configuration for refresh
|
||||
* @param pp
|
||||
*/
|
||||
@VisibleForTesting
|
||||
void refreshAuthManager(PolicyProvider pp);
|
||||
void refreshAuthManager(Configuration conf, PolicyProvider pp);
|
||||
|
||||
RpcScheduler getScheduler();
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ public class TestTokenAuthentication {
|
|||
while (!server.isStarted() && !server.isStopped()) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
server.rpcServer.refreshAuthManager(new PolicyProvider() {
|
||||
server.rpcServer.refreshAuthManager(conf, new PolicyProvider() {
|
||||
@Override
|
||||
public Service[] getServices() {
|
||||
return new Service [] {
|
||||
|
|
Loading…
Reference in New Issue