From 5b93ea155652292ad06ee3df85e5944191eace9b Mon Sep 17 00:00:00 2001 From: zhangduo Date: Sat, 27 Jan 2018 09:01:52 +0800 Subject: [PATCH] HBASE-19866 TestRegionServerReportForDuty doesn't timeout Synchronized on authManager instead of RpcServer --- .../apache/hadoop/hbase/ipc/RpcServer.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java index 1faee909900..d60612fd535 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java @@ -355,10 +355,12 @@ public abstract class RpcServer implements RpcServerInterface, } @Override - public synchronized void refreshAuthManager(PolicyProvider pp) { + public void refreshAuthManager(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); + synchronized (authManager) { + authManager.refresh(this.conf, pp); + } } protected AuthenticationTokenSecretManager createSecretManager() { @@ -534,19 +536,18 @@ public abstract class RpcServer implements RpcServerInterface, /** * Authorize the incoming client connection. - * * @param user client user * @param connection incoming connection * @param addr InetAddress of incoming connection - * @throws org.apache.hadoop.security.authorize.AuthorizationException - * when the client isn't authorized to talk the protocol + * @throws AuthorizationException when the client isn't authorized to talk the protocol */ - public synchronized void authorize(UserGroupInformation user, - ConnectionHeader connection, InetAddress addr) - throws AuthorizationException { + public void authorize(UserGroupInformation user, ConnectionHeader connection, + InetAddress addr) throws AuthorizationException { if (authorize) { Class c = getServiceInterface(services, connection.getServiceName()); - this.authManager.authorize(user != null ? user : null, c, getConf(), addr); + synchronized (authManager) { + authManager.authorize(user, c, getConf(), addr); + } } }