@Override
    public void retireApi(Api api, IAsyncResultHandler<Void> handler) {
        String apiIdx = getApiIndex(api);
        Exception error = null;
        synchronized (mutex) {
            Api removedApi = (Api) getMap().remove(apiIdx);
            if (removedApi == null) {
                error = new ApiNotFoundException(Messages.i18n.format("InMemoryRegistry.ApiNotFound")); //$NON-NLS-1$
            }
        }
        if (error == null) {
            handler.handle(AsyncResultImpl.create((Void) null));
        } else {
            handler.handle(AsyncResultImpl.create(error, Void.class));
        }
    }
@see io.apiman.gateway.engine.IRegistry#retireApi(io.apiman.gateway.engine.beans.Api, io.apiman.gateway.engine.async.IAsyncResultHandler)
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java