public ApiFuture < Boolean > existsAsync ( String instanceId ) { ApiFuture < Instance > protoFuture = getInstanceAsync ( instanceId ) ; ApiFuture < Boolean > existsFuture = ApiFutures . transform ( protoFuture , new ApiFunction < Instance , Boolean > ( ) { @ Override public Boolean apply ( Instance ignored ) { return true ; } } , MoreExecutors . directExecutor ( ) ) ; return ApiFutures . catching ( existsFuture , NotFoundException . class , new ApiFunction < NotFoundException , Boolean > ( ) { @ Override public Boolean apply ( NotFoundException ignored ) { return false ; } } , MoreExecutors . directExecutor ( ) ) ; }
Asynchronously checks if the instance specified by the instanceId exists