It seems it's possible to get an NPE when the region server is stopped, please open a jira.
J-D On Fri, Mar 18, 2011 at 12:52 AM, Gaojinchao <[email protected]> wrote: > It will throw NullPointerException while the masterAddress is null. > > > private HServerAddress getMaster() { > > HServerAddress masterAddress = null; > HMasterRegionInterface master = null; > > while (!stopped && master == null) { > > masterAddress = getMasterAddress(); // it may be null in some > scenarios stopping region server > > LOG.info("Attempting connect to Master server at " + masterAddress); > try { > // Do initial RPC setup. The final argument indicates that the RPC > // should retry indefinitely. > master = (HMasterRegionInterface) HBaseRPC.waitForProxy( > HMasterRegionInterface.class, HBaseRPCProtocolVersion.versionID, > masterAddress.getInetSocketAddress(), this.conf, -1, > this.rpcTimeout, this.rpcTimeout); > } catch (IOException e) { > e = e instanceof RemoteException ? > ((RemoteException)e).unwrapRemoteException() : e; > if (e instanceof ServerNotRunningException) { > LOG.info("Master isn't available yet, retrying"); > } else { > LOG.warn("Unable to connect to master. Retrying. Error was:", e); > } > sleeper.sleep(); > } > } > LOG.info("Connected to master at " + masterAddress); > this.hbaseMaster = master; > return masterAddress; > } > > /** > * > * @return hmaster address > */ > private HServerAddress getMasterAddress() { > HServerAddress masterAddress = null; > while ((masterAddress = masterAddressManager.getMasterAddress()) == > null) { > if (stopped) { > return null; > } > LOG.debug("No master found, will retry"); > sleeper.sleep(); > } > return masterAddress; > } >
