HBASE-19708 Avoid NPE when the RPC listener's accept channel is closed
This commit is contained in:
parent
b5ec4d381c
commit
b528cd01b7
|
@ -206,6 +206,7 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
||||||
|
|
||||||
protected final InetSocketAddress bindAddress;
|
protected final InetSocketAddress bindAddress;
|
||||||
protected int port; // port we listen on
|
protected int port; // port we listen on
|
||||||
|
protected InetSocketAddress address; // inet address we listen on
|
||||||
private int readThreads; // number of read threads
|
private int readThreads; // number of read threads
|
||||||
protected int maxIdleTime; // the maximum idle time after
|
protected int maxIdleTime; // the maximum idle time after
|
||||||
// which a client may be
|
// which a client may be
|
||||||
|
@ -657,6 +658,8 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
||||||
// Bind the server socket to the binding addrees (can be different from the default interface)
|
// Bind the server socket to the binding addrees (can be different from the default interface)
|
||||||
bind(acceptChannel.socket(), bindAddress, backlogLength);
|
bind(acceptChannel.socket(), bindAddress, backlogLength);
|
||||||
port = acceptChannel.socket().getLocalPort(); //Could be an ephemeral port
|
port = acceptChannel.socket().getLocalPort(); //Could be an ephemeral port
|
||||||
|
address = (InetSocketAddress)acceptChannel.socket().getLocalSocketAddress();
|
||||||
|
|
||||||
// create a selector;
|
// create a selector;
|
||||||
selector= Selector.open();
|
selector= Selector.open();
|
||||||
|
|
||||||
|
@ -888,7 +891,7 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
InetSocketAddress getAddress() {
|
InetSocketAddress getAddress() {
|
||||||
return (InetSocketAddress)acceptChannel.socket().getLocalSocketAddress();
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
void doAccept(SelectionKey key) throws IOException, OutOfMemoryError {
|
void doAccept(SelectionKey key) throws IOException, OutOfMemoryError {
|
||||||
|
@ -2197,7 +2200,6 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
|
||||||
|
|
||||||
this.cellBlockBuilder = new CellBlockBuilder(conf);
|
this.cellBlockBuilder = new CellBlockBuilder(conf);
|
||||||
|
|
||||||
|
|
||||||
// Create the responder here
|
// Create the responder here
|
||||||
responder = new Responder();
|
responder = new Responder();
|
||||||
this.authorize = conf.getBoolean(HADOOP_SECURITY_AUTHORIZATION, false);
|
this.authorize = conf.getBoolean(HADOOP_SECURITY_AUTHORIZATION, false);
|
||||||
|
|
Loading…
Reference in New Issue