@Override
    public void publish(Api api) throws PublishingException, NotAuthorizedException {
        final Set<Throwable> errorHolder = new HashSet<>();
        final CountDownLatch latch = new CountDownLatch(1);
        // Publish api; latch until result returned and evaluated
        getEngine().getRegistry().publishApi(api, latchedResultHandler(latch, errorHolder));
        awaitOnLatch(latch, errorHolder);
    }
@see IApiResource#publish(io.apiman.gateway.engine.beans.Api)
gateway/api/rest-impl/src/main/java/io/apiman/gateway/api/rest/impl/ApiResourceImpl.java