protected static void waitForDeliveryStreamToBecomeAvailable ( String deliveryStreamName ) throws Exception { LOG . info ( "Waiting for " + deliveryStreamName + " to become ACTIVE..." ) ; long startTime = System . currentTimeMillis ( ) ; long endTime = startTime + ( 10 * 60 * 1000 ) ; while ( System . currentTimeMillis ( ) < endTime ) { try { Thread . sleep ( 1000 * 20 ) ; } catch ( InterruptedException e ) { // Ignore interruption (doesn't impact deliveryStream creation) } DeliveryStreamDescription deliveryStreamDescription = describeDeliveryStream ( deliveryStreamName ) ; String deliveryStreamStatus = deliveryStreamDescription . getDeliveryStreamStatus ( ) ; LOG . info ( " - current state: " + deliveryStreamStatus ) ; if ( deliveryStreamStatus . equals ( "ACTIVE" ) ) { return ; } } throw new AmazonServiceException ( "DeliveryStream " + deliveryStreamName + " never went active" ) ; }
Method to wait until the delivery stream becomes active .