examples/pubsub-publish-avro-example/src/main/java/com/google/cloud/pso/pubsub/common/ObjectPublisher.java
/**
     * Waits for all the {@link ApiFuture} to complete before shutting down
     * the {@link ExecutorService}
     */
Waits for all the  ApiFuture to complete before shutting down
the  ExecutorService
Waits for all the ApiFuture to complete before shutting down the ExecutorService
private void waitForPublishes() {
        try {
            while (awaitedFutures.longValue() > 0) {
                TimeUnit.MILLISECONDS.sleep(DEFAULT_THREAD_SLEEP);
            }
        } catch (InterruptedException e) {
            System.out.println("Error while waiting for completion: " + e);
        }
        executor.shutdown();
    }
private void waitForPublishes ( ) { try { while ( awaitedFutures . longValue ( ) > 0 ) { TimeUnit . MILLISECONDS . sleep ( DEFAULT_THREAD_SLEEP ) ; } } catch ( InterruptedException e ) { System . out . println ( "Error while waiting for completion: " + e ) ; } executor . shutdown ( ) ; }
Waits for all the {@link ApiFuture} to complete before shutting down
 the {@link ExecutorService}
Waits for all the { @link ApiFuture } to complete before shutting down the { @link ExecutorService }