protected SequenceSet getSequenceSet(Transaction tx, StoredDestination sd, String subscriptionKey) throws IOException { if (sd.ackPositions != null) { final SequenceSet messageSequences = sd.ackPositions.get(tx, subscriptionKey); return messageSequences; } return null; }
private boolean isSequenceReferenced(final Transaction tx, final StoredDestination sd, final Long sequenceId) throws IOException { for(String subscriptionKey : sd.subscriptionCache) { SequenceSet sequence = sd.ackPositions.get(tx, subscriptionKey); if (sequence != null && sequence.contains(sequenceId)) { return true; } } return false; }
protected long getStoredMessageCount(Transaction tx, StoredDestination sd, String subscriptionKey) throws IOException { if (sd.ackPositions != null) { SequenceSet messageSequences = sd.ackPositions.get(tx, subscriptionKey); if (messageSequences != null) { long result = messageSequences.rangeSize(); // if there's anything in the range the last value is always the nextMessage marker, so remove 1. return result > 0 ? result - 1 : 0; } } return 0; }
final SequenceSet messageSequences = sd.ackPositions.get(tx, subscriptionKey); if (messageSequences != null && !messageSequences.isEmpty()) { final long head = messageSequences.getHead().getFirst();
protected long getStoredMessageSize(Transaction tx, StoredDestination sd, String subscriptionKey) throws IOException { long locationSize = 0; if (sd.ackPositions != null) { //grab the messages attached to this subscription SequenceSet messageSequences = sd.ackPositions.get(tx, subscriptionKey); if (messageSequences != null && !messageSequences.isEmpty()) { final Sequence head = messageSequences.getHead(); //get an iterator over the order index starting at the first unacked message //and go over each message to add up the size Iterator<Entry<Long, MessageKeys>> iterator = sd.orderIndex.iterator(tx, new MessageOrderCursor(head.getFirst())); final boolean contiguousRange = messageSequences.size() == 1; while (iterator.hasNext()) { Entry<Long, MessageKeys> entry = iterator.next(); //Verify sequence contains the key //if contiguous we just add all starting with the first but if not //we need to check if the id is part of the range - could happen if individual ack mode was used if (contiguousRange || messageSequences.contains(entry.getKey())) { locationSize += entry.getValue().location.getSize(); } } } } return locationSize; }
private void addAckLocation(Transaction tx, StoredDestination sd, Long messageSequence, String subscriptionKey) throws IOException { SequenceSet sequences = sd.ackPositions.get(tx, subscriptionKey); if (sequences == null) { sequences = new SequenceSet(); sequences.add(messageSequence); sd.ackPositions.add(tx, subscriptionKey, sequences); } else { sequences.add(messageSequence); sd.ackPositions.put(tx, subscriptionKey, sequences); } }
final StoredDestination destination = entry.getValue(); final String subscriptionKey = subscription.getKey(); SequenceSet pendingAcks = destination.ackPositions.get(tx, subscriptionKey);
SequenceSet range = sd.ackPositions.get(tx, subscriptionKey); if (range != null && !range.isEmpty()) { range.remove(messageSequence);
private void addAckLocationForNewMessage(Transaction tx, KahaDestination kahaDest, StoredDestination sd, Long messageSequence) throws IOException { for(String subscriptionKey : sd.subscriptionCache) { SequenceSet sequences = sd.ackPositions.get(tx, subscriptionKey); if (sequences == null) { sequences = new SequenceSet(); sequences.add(new Sequence(messageSequence, messageSequence + 1)); sd.ackPositions.add(tx, subscriptionKey, sequences); } else { sequences.add(new Sequence(messageSequence, messageSequence + 1)); sd.ackPositions.put(tx, subscriptionKey, sequences); } MessageKeys key = sd.orderIndex.get(tx, messageSequence); incrementAndAddSizeToStoreStat(kahaDest, subscriptionKey, key.location.getSize()); } }
Location existing = sd.subLocations.get(tx, subscriptionKey); if (existing != null && existing.compareTo(location) == 0) {
protected long getStoredMessageCount(Transaction tx, StoredDestination sd, String subscriptionKey) throws IOException { if (sd.ackPositions != null) { SequenceSet messageSequences = sd.ackPositions.get(tx, subscriptionKey); if (messageSequences != null) { long result = messageSequences.rangeSize(); // if there's anything in the range the last value is always the nextMessage marker, so remove 1. return result > 0 ? result - 1 : 0; } } return 0; }
protected long getStoredMessageCount(Transaction tx, StoredDestination sd, String subscriptionKey) throws IOException { if (sd.ackPositions != null) { SequenceSet messageSequences = sd.ackPositions.get(tx, subscriptionKey); if (messageSequences != null) { long result = messageSequences.rangeSize(); // if there's anything in the range the last value is always the nextMessage marker, so remove 1. return result > 0 ? result - 1 : 0; } } return 0; }
private boolean isSequenceReferenced(final Transaction tx, final StoredDestination sd, final Long sequenceId) throws IOException { for(String subscriptionKey : sd.subscriptionCache) { SequenceSet sequence = sd.ackPositions.get(tx, subscriptionKey); if (sequence != null && sequence.contains(sequenceId)) { return true; } } return false; }
protected long getStoredMessageCount(Transaction tx, StoredDestination sd, String subscriptionKey) throws IOException { if (sd.ackPositions != null) { SequenceSet messageSequences = sd.ackPositions.get(tx, subscriptionKey); if (messageSequences != null) { long result = messageSequences.rangeSize(); // if there's anything in the range the last value is always the nextMessage marker, so remove 1. return result > 0 ? result - 1 : 0; } } return 0; }
private boolean isSequenceReferenced(final Transaction tx, final StoredDestination sd, final Long sequenceId) throws IOException { for(String subscriptionKey : sd.subscriptionCache) { SequenceSet sequence = sd.ackPositions.get(tx, subscriptionKey); if (sequence != null && sequence.contains(sequenceId)) { return true; } } return false; }
private boolean isSequenceReferenced(final Transaction tx, final StoredDestination sd, final Long sequenceId) throws IOException { for(String subscriptionKey : sd.subscriptionCache) { SequenceSet sequence = sd.ackPositions.get(tx, subscriptionKey); if (sequence != null && sequence.contains(sequenceId)) { return true; } } return false; }
private void addAckLocation(Transaction tx, StoredDestination sd, Long messageSequence, String subscriptionKey) throws IOException { SequenceSet sequences = sd.ackPositions.get(tx, subscriptionKey); if (sequences == null) { sequences = new SequenceSet(); sequences.add(messageSequence); sd.ackPositions.add(tx, subscriptionKey, sequences); } else { sequences.add(messageSequence); sd.ackPositions.put(tx, subscriptionKey, sequences); } }
private void addAckLocation(Transaction tx, StoredDestination sd, Long messageSequence, String subscriptionKey) throws IOException { SequenceSet sequences = sd.ackPositions.get(tx, subscriptionKey); if (sequences == null) { sequences = new SequenceSet(); sequences.add(messageSequence); sd.ackPositions.add(tx, subscriptionKey, sequences); } else { sequences.add(messageSequence); sd.ackPositions.put(tx, subscriptionKey, sequences); } }
private void addAckLocation(Transaction tx, StoredDestination sd, Long messageSequence, String subscriptionKey) throws IOException { SequenceSet sequences = sd.ackPositions.get(tx, subscriptionKey); if (sequences == null) { sequences = new SequenceSet(); sequences.add(messageSequence); sd.ackPositions.add(tx, subscriptionKey, sequences); } else { sequences.add(messageSequence); sd.ackPositions.put(tx, subscriptionKey, sequences); } }
private void addAckLocationForNewMessage(Transaction tx, KahaDestination kahaDest, StoredDestination sd, Long messageSequence) throws IOException { for(String subscriptionKey : sd.subscriptionCache) { SequenceSet sequences = sd.ackPositions.get(tx, subscriptionKey); if (sequences == null) { sequences = new SequenceSet(); sequences.add(new Sequence(messageSequence, messageSequence + 1)); sd.ackPositions.add(tx, subscriptionKey, sequences); } else { sequences.add(new Sequence(messageSequence, messageSequence + 1)); sd.ackPositions.put(tx, subscriptionKey, sequences); } MessageKeys key = sd.orderIndex.get(tx, messageSequence); incrementAndAddSizeToStoreStat(kahaDest, subscriptionKey, key.location.getSize()); } }