protected void revoke()

in common/src/main/java/org/jetbrains/teamcity/vault/support/LifecycleAwareSessionManager.java [90:115]


    protected void revoke(VaultToken token) {
        RuntimeException e = null;
        int[] backoffs = {1, 3, 6, 0}; // last is not used
        for (int backoff : backoffs) {
            try {
                restOperations.postForObject("auth/token/revoke-self",
                        new HttpEntity<Object>(VaultHttpHeaders.from(token)), Map.class);
                return;
            } catch (RuntimeException re) {
                e = re;
                try {
                    //noinspection ImplicitNumericConversion
                    TimeUnit.SECONDS.sleep(backoff);
                } catch (InterruptedException ignored) {
                }
            }
        }
        String message = "Cannot revoke HashiCorp Vault token: ";
        if (e instanceof HttpStatusCodeException) {
            message += VaultResponses.getError((HttpStatusCodeException) e);
        } else {
            message += e.getMessage();
        }
        LOG.warn(message, e);
        logger.warning(message);
    }