HBASE-19866 TestRegionServerReportForDuty doesn't timeout

Synchronized on authManager instead of RpcServer
This commit is contained in:
zhangduo 2018-01-27 09:01:52 +08:00
parent 5b0d7dc45b
commit f8bde7b76c
1 changed files with 10 additions and 9 deletions

View File

@ -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);
}
}
}