@@ -380,8 +380,8 @@ public class HRegionServer extends HBaseServerBase<RSRpcServices>
380380 private Map <String , Service > coprocessorServiceHandlers = Maps .newHashMap ();
381381
382382 /**
383- * @deprecated since 2.4.0 and will be removed in 4.0.0.
384- * Use {@link HRegionServer#UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY} instead.
383+ * @deprecated since 2.4.0 and will be removed in 4.0.0. Use
384+ * {@link HRegionServer#UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY} instead.
385385 * @see <a href="https://issues.apache.org/jira/browse/HBASE-24667">HBASE-24667</a>
386386 */
387387 @ Deprecated
@@ -521,9 +521,10 @@ protected String getUseThisHostnameInstead(Configuration conf) throws IOExceptio
521521 String hostname = conf .get (UNSAFE_RS_HOSTNAME_KEY );
522522 if (conf .getBoolean (UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY , false )) {
523523 if (!StringUtils .isBlank (hostname )) {
524- String msg = UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY + " and " + UNSAFE_RS_HOSTNAME_KEY +
525- " are mutually exclusive. Do not set " + UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY +
526- " to true while " + UNSAFE_RS_HOSTNAME_KEY + " is used" ;
524+ String msg = UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY + " and " +
525+ UNSAFE_RS_HOSTNAME_KEY + " are mutually exclusive. Do not set " +
526+ UNSAFE_RS_HOSTNAME_DISABLE_MASTER_REVERSEDNS_KEY + " to true while " +
527+ UNSAFE_RS_HOSTNAME_KEY + " is used" ;
527528 throw new IOException (msg );
528529 } else {
529530 return rpcServices .getSocketAddress ().getHostName ();
@@ -617,7 +618,9 @@ public boolean registerService(Service instance) {
617618 private static void checkCodecs (final Configuration c ) throws IOException {
618619 // check to see if the codec list is available:
619620 String [] codecs = c .getStrings (REGIONSERVER_CODEC , (String [])null );
620- if (codecs == null ) return ;
621+ if (codecs == null ) {
622+ return ;
623+ }
621624 for (String codec : codecs ) {
622625 if (!CompressionTest .testCompression (codec )) {
623626 throw new IOException ("Compression codec " + codec +
@@ -852,9 +855,15 @@ public void run() {
852855
853856 // Send interrupts to wake up threads if sleeping so they notice shutdown.
854857 // TODO: Should we check they are alive? If OOME could have exited already
855- if (this .hMemManager != null ) this .hMemManager .stop ();
856- if (this .cacheFlusher != null ) this .cacheFlusher .interruptIfNecessary ();
857- if (this .compactSplitThread != null ) this .compactSplitThread .interruptIfNecessary ();
858+ if (this .hMemManager != null ) {
859+ this .hMemManager .stop ();
860+ }
861+ if (this .cacheFlusher != null ) {
862+ this .cacheFlusher .interruptIfNecessary ();
863+ }
864+ if (this .compactSplitThread != null ) {
865+ this .compactSplitThread .interruptIfNecessary ();
866+ }
858867
859868 // Stop the snapshot and other procedure handlers, forcefully killing all running tasks
860869 if (rspmHost != null ) {
@@ -949,7 +958,9 @@ private boolean containsMetaTableRegions() {
949958 }
950959
951960 private boolean areAllUserRegionsOffline () {
952- if (getNumberOfOnlineRegions () > 2 ) return false ;
961+ if (getNumberOfOnlineRegions () > 2 ) {
962+ return false ;
963+ }
953964 boolean allUserRegionsOffline = true ;
954965 for (Map .Entry <String , HRegion > e : this .onlineRegions .entrySet ()) {
955966 if (!e .getValue ().getRegionInfo ().isMetaRegion ()) {
@@ -1185,7 +1196,9 @@ private ClusterStatusProtos.ServerLoad buildServerLoad(long reportStartTime, lon
11851196 private String getOnlineRegionsAsPrintableString () {
11861197 StringBuilder sb = new StringBuilder ();
11871198 for (Region r : this .onlineRegions .values ()) {
1188- if (sb .length () > 0 ) sb .append (", " );
1199+ if (sb .length () > 0 ) {
1200+ sb .append (", " );
1201+ }
11891202 sb .append (r .getRegionInfo ().getEncodedName ());
11901203 }
11911204 return sb .toString ();
@@ -1284,7 +1297,7 @@ private void shutdownWAL(final boolean close) {
12841297 * @param c Extra configuration.
12851298 */
12861299 protected void handleReportForDutyResponse (final RegionServerStartupResponse c )
1287- throws IOException {
1300+ throws IOException {
12881301 try {
12891302 boolean updateRootDir = false ;
12901303 for (NameStringPair e : c .getMapEntriesList ()) {
@@ -1560,7 +1573,7 @@ protected void chore() {
15601573 this .instance .compactSplitThread .requestCompaction (hr , s ,
15611574 getName () + " requests major compaction; use default priority" ,
15621575 Store .NO_PRIORITY ,
1563- CompactionLifeCycleTracker .DUMMY , null );
1576+ CompactionLifeCycleTracker .DUMMY , null );
15641577 } else {
15651578 this .instance .compactSplitThread .requestCompaction (hr , s ,
15661579 getName () + " requests major compaction; use configured priority" ,
@@ -1595,7 +1608,9 @@ private static class PeriodicMemStoreFlusher extends ScheduledChore {
15951608 protected void chore () {
15961609 final StringBuilder whyFlush = new StringBuilder ();
15971610 for (HRegion r : this .server .onlineRegions .values ()) {
1598- if (r == null ) continue ;
1611+ if (r == null ) {
1612+ continue ;
1613+ }
15991614 if (r .shouldFlush (whyFlush )) {
16001615 FlushRequester requester = server .getFlushRequester ();
16011616 if (requester != null ) {
@@ -1698,7 +1713,7 @@ private void startServices() throws IOException {
16981713 // Health checker thread.
16991714 if (isHealthCheckerConfigured ()) {
17001715 int sleepTime = this .conf .getInt (HConstants .HEALTH_CHORE_WAKE_FREQ ,
1701- HConstants .DEFAULT_THREAD_WAKE_FREQUENCY );
1716+ HConstants .DEFAULT_THREAD_WAKE_FREQUENCY );
17021717 healthCheckChore = new HealthCheckChore (sleepTime , this , getConfiguration ());
17031718 }
17041719 // Executor status collect thread.
@@ -2134,7 +2149,9 @@ public boolean reportRegionStateTransition(final RegionStateTransitionContext co
21342149 " after " + pauseTime + "ms delay (Master is coming online...)." :
21352150 " immediately." ),
21362151 ioe );
2137- if (pause ) Threads .sleep (pauseTime );
2152+ if (pause ) {
2153+ Threads .sleep (pauseTime );
2154+ }
21382155 tries ++;
21392156 if (rssStub == rss ) {
21402157 rssStub = null ;
@@ -2168,7 +2185,7 @@ private void triggerFlushInPrimaryRegion(final HRegion region) {
21682185 } else {
21692186 LOG .info ("Executor is null; not running flush of primary region replica for {}" ,
21702187 region .getRegionInfo ());
2171- }
2188+ }
21722189 }
21732190
21742191 @ InterfaceAudience .Private
@@ -2299,8 +2316,7 @@ protected void stopServiceThreads() {
22992316 }
23002317
23012318 /**
2302- * @return Return the object that implements the replication
2303- * source executorService.
2319+ * @return Return the object that implements the replication source executorService.
23042320 */
23052321 @ Override
23062322 public ReplicationSourceService getReplicationSourceService () {
@@ -2397,8 +2413,8 @@ protected synchronized ServerName createRegionServerStatusStub(boolean refresh)
23972413 }
23982414
23992415 /**
2400- * @return True if we should break loop because cluster is going down or
2401- * this server has been stopped or hdfs has gone bad.
2416+ * @return True if we should break loop because cluster is going down or this server has been
2417+ * stopped or hdfs has gone bad.
24022418 */
24032419 private boolean keepLooping () {
24042420 return !this .stopped && isClusterUp ();
@@ -2412,10 +2428,14 @@ private boolean keepLooping() {
24122428 * @throws IOException
24132429 */
24142430 private RegionServerStartupResponse reportForDuty () throws IOException {
2415- if (this .masterless ) return RegionServerStartupResponse .getDefaultInstance ();
2431+ if (this .masterless ) {
2432+ return RegionServerStartupResponse .getDefaultInstance ();
2433+ }
24162434 ServerName masterServerName = createRegionServerStatusStub (true );
24172435 RegionServerStatusService .BlockingInterface rss = rssStub ;
2418- if (masterServerName == null || rss == null ) return null ;
2436+ if (masterServerName == null || rss == null ) {
2437+ return null ;
2438+ }
24192439 RegionServerStartupResponse result = null ;
24202440 try {
24212441 rpcServices .requestCount .reset ();
@@ -2493,12 +2513,16 @@ private void closeMetaTableRegions(final boolean abort) {
24932513 if (hri .isMetaRegion ()) {
24942514 meta = e .getValue ();
24952515 }
2496- if (meta != null ) break ;
2516+ if (meta != null ) {
2517+ break ;
2518+ }
24972519 }
24982520 } finally {
24992521 this .onlineRegionsLock .writeLock ().unlock ();
25002522 }
2501- if (meta != null ) closeRegionIgnoreErrors (meta .getRegionInfo (), abort );
2523+ if (meta != null ) {
2524+ closeRegionIgnoreErrors (meta .getRegionInfo (), abort );
2525+ }
25022526 }
25032527
25042528 /**
@@ -2722,17 +2746,17 @@ public static void main(String[] args) {
27222746 */
27232747 @ Override
27242748 public List <HRegion > getRegions (TableName tableName ) {
2725- List <HRegion > tableRegions = new ArrayList <>();
2726- synchronized (this .onlineRegions ) {
2727- for (HRegion region : this .onlineRegions .values ()) {
2728- RegionInfo regionInfo = region .getRegionInfo ();
2729- if (regionInfo .getTable ().equals (tableName )) {
2730- tableRegions .add (region );
2731- }
2732- }
2733- }
2734- return tableRegions ;
2735- }
2749+ List <HRegion > tableRegions = new ArrayList <>();
2750+ synchronized (this .onlineRegions ) {
2751+ for (HRegion region : this .onlineRegions .values ()) {
2752+ RegionInfo regionInfo = region .getRegionInfo ();
2753+ if (regionInfo .getTable ().equals (tableName )) {
2754+ tableRegions .add (region );
2755+ }
2756+ }
2757+ }
2758+ return tableRegions ;
2759+ }
27362760
27372761 @ Override
27382762 public List <HRegion > getRegions () {
@@ -2906,13 +2930,16 @@ public boolean removeRegion(final HRegion r, ServerName destination) {
29062930 if (closeSeqNum == HConstants .NO_SEQNUM ) {
29072931 // No edits in WAL for this region; get the sequence number when the region was opened.
29082932 closeSeqNum = r .getOpenSeqNum ();
2909- if (closeSeqNum == HConstants .NO_SEQNUM ) closeSeqNum = 0 ;
2933+ if (closeSeqNum == HConstants .NO_SEQNUM ) {
2934+ closeSeqNum = 0 ;
2935+ }
29102936 }
29112937 boolean selfMove = ServerName .isSameAddress (destination , this .getServerName ());
29122938 addToMovedRegions (r .getRegionInfo ().getEncodedName (), destination , closeSeqNum , selfMove );
29132939 if (selfMove ) {
2914- this .regionServerAccounting .getRetainedRegionRWRequestsCnt ().put (r .getRegionInfo ().getEncodedName ()
2915- , new Pair <>(r .getReadRequestsCount (), r .getWriteRequestsCount ()));
2940+ this .regionServerAccounting .getRetainedRegionRWRequestsCnt ().put (
2941+ r .getRegionInfo ().getEncodedName (),
2942+ new Pair <>(r .getReadRequestsCount (), r .getWriteRequestsCount ()));
29162943 }
29172944 }
29182945 this .regionFavoredNodesMap .remove (r .getRegionInfo ().getEncodedName ());
@@ -3028,7 +3055,7 @@ public void updateRegionFavoredNodesMapping(String encodedRegionName,
30283055 * Return the favored nodes for a region given its encoded name. Look at the
30293056 * comment around {@link #regionFavoredNodesMap} on why we convert to InetSocketAddress[]
30303057 * here.
3031- * @param encodedRegionName
3058+ * @param encodedRegionName the encoded region name.
30323059 * @return array of favored locations
30333060 */
30343061 @ Override
@@ -3048,7 +3075,7 @@ private static class MovedRegionInfo {
30483075 MovedRegionInfo (ServerName serverName , long closeSeqNum ) {
30493076 this .serverName = serverName ;
30503077 this .seqNum = closeSeqNum ;
3051- }
3078+ }
30523079
30533080 public ServerName getServerName () {
30543081 return serverName ;
@@ -3065,7 +3092,8 @@ public long getSeqNum() {
30653092 */
30663093 private static final int TIMEOUT_REGION_MOVED = (2 * 60 * 1000 );
30673094
3068- private void addToMovedRegions (String encodedName , ServerName destination , long closeSeqNum , boolean selfMove ) {
3095+ private void addToMovedRegions (String encodedName , ServerName destination ,
3096+ long closeSeqNum , boolean selfMove ) {
30693097 if (selfMove ) {
30703098 LOG .warn ("Not adding moved region record: " + encodedName + " to self." );
30713099 return ;
@@ -3086,7 +3114,7 @@ public MovedRegionInfo getMovedRegion(String encodedRegionName) {
30863114
30873115 @ InterfaceAudience .Private
30883116 public int movedRegionCacheExpiredTime () {
3089- return TIMEOUT_REGION_MOVED ;
3117+ return TIMEOUT_REGION_MOVED ;
30903118 }
30913119
30923120 private String getMyEphemeralNodePath () {
@@ -3114,8 +3142,8 @@ CoprocessorServiceResponse execRegionServerService(
31143142 String serviceName = call .getServiceName ();
31153143 Service service = coprocessorServiceHandlers .get (serviceName );
31163144 if (service == null ) {
3117- throw new UnknownProtocolException (null , "No registered coprocessor executorService found for " +
3118- serviceName );
3145+ throw new UnknownProtocolException (null ,
3146+ "No registered coprocessor executorService found for " + serviceName );
31193147 }
31203148 ServiceDescriptor serviceDesc =
31213149 service .getDescriptorForType ();
0 commit comments