question: public < T extends ServiceDocument > T waitForServiceState ( Class < T > type , String serviceUri , Predicate < T > test , int waitIterationSleep , int waitIterationCount ) throws Throwable { T result = null ; for ( int i = 0 ; i < hosts . length ; i ++ ) { ServiceHost host = hosts [ i ] ; T r = ServiceHostUtils . waitForServiceState ( type , serviceUri , test , host , waitIterationSleep , waitIterationCount , getEnvironmentCleanup ( ) ) ; assert ( r != null ) ; logger . info ( "host " + host . getState ( ) . id + " has owner " + r . documentOwner ) ; if ( result != null && ! ServiceUtils . documentEquals ( type , result , r ) ) { logger . info ( String . format ( "current %s last %s" , Utils . toJson ( true , false , r ) , Utils . toJson ( true , false , result ) ) ) ; throw new IllegalStateException ( "response is not consistent across node group" ) ; } result = r ; } return result ; }
target:  Issue GET and wait until the given predicate is true.