private void destroySession() { consul.sessionClient().destroySession(sessionId); sessionId = null; }
/** * Destroys a session. * * PUT /v1/session/destroy/{sessionId} * * @param sessionId The session ID to destroy. */ public void destroySession(final String sessionId) { destroySession(sessionId, null); }
@Override protected void doStop() throws Exception { if (sessionId.get() != null) { if (keyValueClient.releaseLock(this.path, sessionId.get())) { LOGGER.debug("Successfully released lock on path '{}' with id '{}'", path, sessionId.get()); } synchronized (sessionId) { sessionClient.destroySession(sessionId.getAndSet(null)); localMember.setMaster(false); } } }
@InvokeOnHeader(ConsulSessionActions.DESTROY) protected void destroy(Message message) throws Exception { String sessionId = message.getHeader(ConsulConstants.CONSUL_SESSION, String.class); if (ObjectHelper.isEmpty(sessionId)) { getClient().destroySession( message.getMandatoryBody(String.class), message.getHeader(ConsulConstants.CONSUL_DATACENTER, String.class) ); } else { getClient().destroySession( sessionId, message.getHeader(ConsulConstants.CONSUL_DATACENTER, String.class) ); } setBodyAndResult(message, null, true); }
@Override protected void doStop() throws Exception { super.doStop(); if (sessionId != null) { sessionClient.destroySession(sessionId); sessionId = null; } if (executorService != null) { getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService); } }