question: private static void waitForStreamState ( AmazonKinesisClient kinesisClient , String streamName , @ Nullable StreamStatus expectedStatus ) { StreamStatus streamStatus = getStreamState ( kinesisClient , streamName ) ; long waitTime = System . currentTimeMillis ( ) + TIMEOUT ; while ( streamStatus != expectedStatus && waitTime > System . currentTimeMillis ( ) ) { Uninterruptibles . sleepUninterruptibly ( SLEEP_INTERVAL , TimeUnit . MILLISECONDS ) ; streamStatus = getStreamState ( kinesisClient , streamName ) ; } if ( ! ( streamStatus == expectedStatus ) ) { throw new IllegalStateException ( String . format ( "Timed out waiting for stream to be in %s state" , expectedStatus ) ) ; } }
target:  waits for the stream to be in the expected state