@PreDestroy public void destroy() { for (QueueKey key : queryQueues.keySet()) { String objectName = ObjectNames.builder(QueryQueue.class, key.getQueue().getTemplate()) .withProperty("expansion", key.getName()) .build(); mbeanExporter.unexport(objectName); } }
public void setKey(BlockingQueue<Boolean> queue, String newKey) { String oldKey = getKey(queue); if (oldKey == null) { keys.add(new QueueKey(newKey, queue)); } else if (oldKey.equals(newKey)) { for (QueueKey queueKey : keys) { if (oldKey.equals(queueKey.key)) { queueKey.key = newKey; return; } } } }