public boolean remove(MessageId messageId) { writeLock.lock(); try { boolean removed = false; ConcurrentOpenHashSet<MessageId> exist = messageIdPartitionMap.remove(messageId); if (exist != null) { removed = exist.remove(messageId); } return removed; } finally { writeLock.unlock(); } }
public int removeMessagesTill(MessageId msgId) { writeLock.lock(); try { int removed = 0; Iterator<MessageId> iterator = messageIdPartitionMap.keySet().iterator(); while (iterator.hasNext()) { MessageId messageId = iterator.next(); if (messageId.compareTo(msgId) <= 0) { ConcurrentOpenHashSet<MessageId> exist = messageIdPartitionMap.get(messageId); if (exist != null) { exist.remove(messageId); } iterator.remove(); removed ++; } } return removed; } finally { writeLock.unlock(); } }
public int removeTopicMessages(String topicName) { writeLock.lock(); try { int removed = 0; Iterator<MessageId> iterator = messageIdPartitionMap.keySet().iterator(); while (iterator.hasNext()) { MessageId messageId = iterator.next(); if (messageId instanceof TopicMessageIdImpl && ((TopicMessageIdImpl)messageId).getTopicPartitionName().contains(topicName)) { ConcurrentOpenHashSet<MessageId> exist = messageIdPartitionMap.get(messageId); if (exist != null) { exist.remove(messageId); } iterator.remove(); removed ++; } } return removed; } finally { writeLock.unlock(); } }
public boolean add(MessageId m) { readLock.lock(); try { oldOpenSet.remove(m); return currentSet.add(m); } finally { readLock.unlock(); } }
@Override public void removeProducer(Producer producer) { checkArgument(producer.getTopic() == this); if (producers.remove(producer)) { // decrement usage only if this was a valid producer close USAGE_COUNT_UPDATER.decrementAndGet(this); if (log.isDebugEnabled()) { log.debug("[{}] [{}] Removed producer -- count: {}", topic, producer.getProducerName(), USAGE_COUNT_UPDATER.get(this)); } lastActive = System.nanoTime(); } }
/** * Unblocks the dispatchers and removes it from the {@link #blockedDispatchers} list * * @param dispatcherList */ public void unblockDispatchersOnUnAckMessages(List<PersistentDispatcherMultipleConsumers> dispatcherList) { lock.writeLock().lock(); try { dispatcherList.forEach(dispatcher -> { dispatcher.unBlockDispatcherOnUnackedMsgs(); executor().execute(() -> dispatcher.readMoreEntries()); log.info("[{}] Dispatcher is unblocked", dispatcher.getName()); blockedDispatchers.remove(dispatcher); }); } finally { lock.writeLock().unlock(); } }
@Override public void removeProducer(Producer producer) { checkArgument(producer.getTopic() == this); if (producers.remove(producer)) { // decrement usage only if this was a valid producer close USAGE_COUNT_UPDATER.decrementAndGet(this); if (log.isDebugEnabled()) { log.debug("[{}] [{}] Removed producer -- count: {}", topic, producer.getProducerName(), USAGE_COUNT_UPDATER.get(this)); } lastActive = System.nanoTime(); messageDeduplication.producerRemoved(producer.getProducerName()); } }
public boolean removeProducer(ProducerHandler producer) { final String topicName = producer.getProducer().getTopic(); if (topicProducerMap.containsKey(topicName)) { return topicProducerMap.get(topicName).remove(producer); } return false; }
public boolean removeConsumer(ConsumerHandler consumer) { final String topicName = consumer.getConsumer().getTopic(); if (topicConsumerMap.containsKey(topicName)) { return topicConsumerMap.get(topicName).remove(consumer); } return false; }
public boolean removeReader(ReaderHandler reader) { final String topicName = reader.getConsumer().getTopic(); if (topicReaderMap.containsKey(topicName)) { return topicReaderMap.get(topicName).remove(reader); } return false; }