File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed 
hbase-server/src/test/java/org/apache/hadoop/hbase/replication Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -133,13 +133,24 @@ public boolean evaluate() throws Exception {
133133   * @param greaterThan size of replicationLoadSourceList must be greater before we proceed 
134134   */ 
135135  private  List <ReplicationLoadSource > waitOnMetricsReport (int  greaterThan , ServerName  serverName )
136-     throws  IOException  {
137-     ClusterMetrics  metrics  = hbaseAdmin .getClusterMetrics (EnumSet .of (Option .LIVE_SERVERS ));
138-     List <ReplicationLoadSource > list  =
139-       metrics .getLiveServerMetrics ().get (serverName ).getReplicationLoadSourceList ();
140-     while  (list .size () <= greaterThan ) {
141-       Threads .sleep (1000 );
142-     }
143-     return  list ;
136+     throws  Exception  {
137+     UTIL1 .waitFor (30000 , 1000 , new  Waiter .ExplainingPredicate <Exception >() {
138+       @ Override 
139+       public  boolean  evaluate () throws  Exception  {
140+         List <ReplicationLoadSource > list  =
141+           hbaseAdmin .getClusterMetrics (EnumSet .of (Option .LIVE_SERVERS )).getLiveServerMetrics ()
142+             .get (serverName ).getReplicationLoadSourceList ();
143+         return  list .size () > greaterThan ;
144+       }
145+ 
146+       @ Override 
147+       public  String  explainFailure () throws  Exception  {
148+         return  "The ReplicationLoadSourceList's size is lesser than or equal to "  + greaterThan 
149+           + " for "  + serverName ;
150+       }
151+     });
152+ 
153+     return  hbaseAdmin .getClusterMetrics (EnumSet .of (Option .LIVE_SERVERS )).getLiveServerMetrics ()
154+       .get (serverName ).getReplicationLoadSourceList ();
144155  }
145156}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments