@Override public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId, MessageAck ack) throws IOException { String subscriptionKey = subscriptionKey(clientId, subscriptionName).toString(); if (isConcurrentStoreAndDispatchTopics()) { AsyncJobKey key = new AsyncJobKey(messageId, getDestination()); StoreTopicTask task = null; synchronized (asyncTaskMap) { task = (StoreTopicTask) asyncTaskMap.get(key); } if (task != null) { if (task.addSubscriptionKey(subscriptionKey)) { removeTopicTask(this, messageId); if (task.cancel()) { synchronized (asyncTaskMap) { asyncTaskMap.remove(key); } } } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } }
@Override public void run() { this.store.doneTasks++; try { if (this.done.compareAndSet(false, true)) { this.topicStore.addMessage(context, message); // apply any acks we have synchronized (this.subscriptionKeys) { for (String key : this.subscriptionKeys) { this.topicStore.doAcknowledge(context, key, this.message.getMessageId(), null); } } removeTopicTask(this.topicStore, this.message.getMessageId()); this.future.complete(); } else if (cancelledTaskModMetric > 0 && this.store.canceledTasks++ % cancelledTaskModMetric == 0) { System.err.println(this.store.dest.getName() + " cancelled: " + (this.store.canceledTasks / this.store.doneTasks) * 100); this.store.canceledTasks = this.store.doneTasks = 0; } } catch (Throwable t) { this.future.setException(t); removeTopicTask(this.topicStore, this.message.getMessageId()); } } }
@Override public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId, MessageAck ack) throws IOException { String subscriptionKey = subscriptionKey(clientId, subscriptionName).toString(); if (isConcurrentStoreAndDispatchTopics()) { AsyncJobKey key = new AsyncJobKey(messageId, getDestination()); StoreTopicTask task = null; synchronized (asyncTaskMap) { task = (StoreTopicTask) asyncTaskMap.get(key); } if (task != null) { if (task.addSubscriptionKey(subscriptionKey)) { removeTopicTask(this, messageId); if (task.cancel()) { synchronized (asyncTaskMap) { asyncTaskMap.remove(key); } } } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } }
@Override public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId, MessageAck ack) throws IOException { String subscriptionKey = subscriptionKey(clientId, subscriptionName).toString(); if (isConcurrentStoreAndDispatchTopics()) { AsyncJobKey key = new AsyncJobKey(messageId, getDestination()); StoreTopicTask task = null; synchronized (asyncTaskMap) { task = (StoreTopicTask) asyncTaskMap.get(key); } if (task != null) { if (task.addSubscriptionKey(subscriptionKey)) { removeTopicTask(this, messageId); if (task.cancel()) { synchronized (asyncTaskMap) { asyncTaskMap.remove(key); } } } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } }
@Override public void run() { this.store.doneTasks++; try { if (this.done.compareAndSet(false, true)) { this.topicStore.addMessage(context, message); // apply any acks we have synchronized (this.subscriptionKeys) { for (String key : this.subscriptionKeys) { this.topicStore.doAcknowledge(context, key, this.message.getMessageId(), null); } } removeTopicTask(this.topicStore, this.message.getMessageId()); this.future.complete(); } else if (cancelledTaskModMetric > 0 && this.store.canceledTasks++ % cancelledTaskModMetric == 0) { System.err.println(this.store.dest.getName() + " cancelled: " + (this.store.canceledTasks / this.store.doneTasks) * 100); this.store.canceledTasks = this.store.doneTasks = 0; } } catch (Exception e) { this.future.setException(e); } finally { releaseLocks(); } } }
public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId, MessageAck ack) throws IOException { String subscriptionKey = subscriptionKey(clientId, subscriptionName); if (isConcurrentStoreAndDispatchTopics()) { AsyncJobKey key = new AsyncJobKey(messageId, getDestination()); StoreTopicTask task = null; synchronized (asyncTaskMap) { task = (StoreTopicTask) asyncTaskMap.get(key); } if (task != null) { if (task.addSubscriptionKey(subscriptionKey)) { removeTopicTask(this, messageId); if (task.cancel()) { synchronized (asyncTaskMap) { asyncTaskMap.remove(key); } } } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } }
@Override public void run() { this.store.doneTasks++; try { if (this.done.compareAndSet(false, true)) { this.topicStore.addMessage(context, message); // apply any acks we have synchronized (this.subscriptionKeys) { for (String key : this.subscriptionKeys) { this.topicStore.doAcknowledge(context, key, this.message.getMessageId(), null); } } removeTopicTask(this.topicStore, this.message.getMessageId()); this.future.complete(); } else if (cancelledTaskModMetric > 0 && this.store.canceledTasks++ % cancelledTaskModMetric == 0) { System.err.println(this.store.dest.getName() + " cancelled: " + (this.store.canceledTasks / this.store.doneTasks) * 100); this.store.canceledTasks = this.store.doneTasks = 0; } } catch (Throwable t) { this.future.setException(t); removeTopicTask(this.topicStore, this.message.getMessageId()); } } }
@Override public void acknowledge(ConnectionContext context, String clientId, String subscriptionName, MessageId messageId, MessageAck ack) throws IOException { String subscriptionKey = subscriptionKey(clientId, subscriptionName).toString(); if (isConcurrentStoreAndDispatchTopics()) { AsyncJobKey key = new AsyncJobKey(messageId, getDestination()); StoreTopicTask task = null; synchronized (asyncTaskMap) { task = (StoreTopicTask) asyncTaskMap.get(key); } if (task != null) { if (task.addSubscriptionKey(subscriptionKey)) { removeTopicTask(this, messageId); if (task.cancel()) { synchronized (asyncTaskMap) { asyncTaskMap.remove(key); } } } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } } else { doAcknowledge(context, subscriptionKey, messageId, ack); } }
@Override public void run() { this.store.doneTasks++; try { if (this.done.compareAndSet(false, true)) { this.topicStore.addMessage(context, message); // apply any acks we have synchronized (this.subscriptionKeys) { for (String key : this.subscriptionKeys) { this.topicStore.doAcknowledge(context, key, this.message.getMessageId(), null); } } removeTopicTask(this.topicStore, this.message.getMessageId()); this.future.complete(); } else if (cancelledTaskModMetric > 0 && this.store.canceledTasks++ % cancelledTaskModMetric == 0) { System.err.println(this.store.dest.getName() + " cancelled: " + (this.store.canceledTasks / this.store.doneTasks) * 100); this.store.canceledTasks = this.store.doneTasks = 0; } } catch (Throwable t) { this.future.setException(t); removeTopicTask(this.topicStore, this.message.getMessageId()); } } }
@Override public void run() { this.store.doneTasks++; try { if (this.done.compareAndSet(false, true)) { this.topicStore.addMessage(context, message); // apply any acks we have synchronized (this.subscriptionKeys) { for (String key : this.subscriptionKeys) { this.topicStore.doAcknowledge(context, key, this.message.getMessageId(), null); } } removeTopicTask(this.topicStore, this.message.getMessageId()); this.future.complete(); } else if (cancelledTaskModMetric > 0 && this.store.canceledTasks++ % cancelledTaskModMetric == 0) { System.err.println(this.store.dest.getName() + " cancelled: " + (this.store.canceledTasks / this.store.doneTasks) * 100); this.store.canceledTasks = this.store.doneTasks = 0; } } catch (Throwable t) { this.future.setException(t); removeTopicTask(this.topicStore, this.message.getMessageId()); } } }