protected MessageStoreStatistics getStoredMessageStoreStatistics(KahaDestination destination, Transaction tx) throws IOException { StoredDestination sd = getStoredDestination(destination, tx); return sd != null && sd.messageStoreStatistics != null ? sd.messageStoreStatistics.get(tx) : null; }
protected StoredDestination getExistingStoredDestination(KahaDestination destination, Transaction tx) throws IOException { String key = key(destination); StoredDestination rc = storedDestinations.get(key); if (rc == null && metadata.destinations.containsKey(tx, key)) { rc = getStoredDestination(destination, tx); } return rc; }
/** * Update MessageStoreStatistics * * @param kahaDestination * @param size */ protected void incrementAndAddSizeToStoreStat(Transaction tx, KahaDestination kahaDestination, long size) throws IOException { StoredDestination sd = getStoredDestination(kahaDestination, tx); incrementAndAddSizeToStoreStat(tx, key(kahaDestination), sd, size); }
protected void decrementAndSubSizeToStoreStat(Transaction tx, KahaDestination kahaDestination, long size) throws IOException { StoredDestination sd = getStoredDestination(kahaDestination, tx); decrementAndSubSizeToStoreStat(tx, key(kahaDestination), sd,size); }
void updateIndex(Transaction tx, KahaRemoveMessageCommand command, Location ackLocation) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); if (!command.hasSubscriptionKey()) {
void updateIndex(Transaction tx, KahaUpdateMessageCommand updateMessageCommand, Location location) throws IOException { KahaAddMessageCommand command = updateMessageCommand.getMessage(); StoredDestination sd = getStoredDestination(command.getDestination(), tx);
void updateIndex(Transaction tx, KahaSubscriptionCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); final String subscriptionKey = command.getSubscriptionKey();
void updateIndex(Transaction tx, KahaRemoveDestinationCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); sd.orderIndex.remove(tx);
long updateIndex(Transaction tx, KahaAddMessageCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx);
protected StoredDestination getExistingStoredDestination(KahaDestination destination, Transaction tx) throws IOException { String key = key(destination); StoredDestination rc = storedDestinations.get(key); if (rc == null && metadata.destinations.containsKey(tx, key)) { rc = getStoredDestination(destination, tx); } return rc; }
protected StoredDestination getExistingStoredDestination(KahaDestination destination, Transaction tx) throws IOException { String key = key(destination); StoredDestination rc = storedDestinations.get(key); if (rc == null && metadata.destinations.containsKey(tx, key)) { rc = getStoredDestination(destination, tx); } return rc; }
protected StoredDestination getExistingStoredDestination(KahaDestination destination, Transaction tx) throws IOException { String key = key(destination); StoredDestination rc = storedDestinations.get(key); if (rc == null && metadata.destinations.containsKey(tx, key)) { rc = getStoredDestination(destination, tx); } return rc; }
protected StoredDestination getExistingStoredDestination(KahaDestination destination, Transaction tx) throws IOException { String key = key(destination); StoredDestination rc = storedDestinations.get(key); if (rc == null && metadata.destinations.containsKey(tx, key)) { rc = getStoredDestination(destination, tx); } return rc; }
void updateIndex(Transaction tx, KahaSubscriptionCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); final String subscriptionKey = command.getSubscriptionKey(); // If set then we are creating it.. otherwise we are destroying the sub if (command.hasSubscriptionInfo()) { sd.subscriptions.put(tx, subscriptionKey, command); long ackLocation=NOT_ACKED; if (!command.getRetroactive()) { ackLocation = sd.orderIndex.nextMessageId-1; } else { addAckLocationForRetroactiveSub(tx, sd, ackLocation, subscriptionKey); } sd.subscriptionAcks.put(tx, subscriptionKey, new LastAck(ackLocation)); } else { // delete the sub... sd.subscriptions.remove(tx, subscriptionKey); sd.subscriptionAcks.remove(tx, subscriptionKey); removeAckLocationsForSub(tx, sd, subscriptionKey); } }
void updateIndex(Transaction tx, KahaSubscriptionCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); final String subscriptionKey = command.getSubscriptionKey();
void updateIndex(Transaction tx, KahaSubscriptionCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); final String subscriptionKey = command.getSubscriptionKey();
void updateIndex(Transaction tx, KahaRemoveMessageCommand command, Location ackLocation) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); if (!command.hasSubscriptionKey()) { // In the queue case we just remove the message from the index.. Long sequenceId = sd.messageIdIndex.remove(tx, command.getMessageId()); if (sequenceId != null) { MessageKeys keys = sd.orderIndex.remove(tx, sequenceId); if (keys != null) { sd.locationIndex.remove(tx, keys.location); recordAckMessageReferenceLocation(ackLocation, keys.location); } } } else { // In the topic case we need remove the message once it's been acked // by all the subs Long sequence = sd.messageIdIndex.get(tx, command.getMessageId()); // Make sure it's a valid message id... if (sequence != null) { String subscriptionKey = command.getSubscriptionKey(); if (command.getAck() != UNMATCHED) { sd.orderIndex.get(tx, sequence); byte priority = sd.orderIndex.lastGetPriority(); sd.subscriptionAcks.put(tx, subscriptionKey, new LastAck(sequence, priority)); } // The following method handles deleting un-referenced messages. removeAckLocation(tx, sd, subscriptionKey, sequence); } } }
void updateIndex(Transaction tx, KahaRemoveDestinationCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); sd.orderIndex.remove(tx); sd.locationIndex.clear(tx); sd.locationIndex.unload(tx); tx.free(sd.locationIndex.getPageId()); sd.messageIdIndex.clear(tx); sd.messageIdIndex.unload(tx); tx.free(sd.messageIdIndex.getPageId()); if (sd.subscriptions != null) { sd.subscriptions.clear(tx); sd.subscriptions.unload(tx); tx.free(sd.subscriptions.getPageId()); sd.subscriptionAcks.clear(tx); sd.subscriptionAcks.unload(tx); tx.free(sd.subscriptionAcks.getPageId()); sd.ackPositions.clear(tx); sd.ackPositions.unload(tx); tx.free(sd.ackPositions.getPageId()); } String key = key(command.getDestination()); storedDestinations.remove(key); metadata.destinations.remove(tx, key); }
void updateIndex(Transaction tx, KahaRemoveDestinationCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); sd.orderIndex.remove(tx); sd.locationIndex.clear(tx); sd.locationIndex.unload(tx); tx.free(sd.locationIndex.getPageId()); sd.messageIdIndex.clear(tx); sd.messageIdIndex.unload(tx); tx.free(sd.messageIdIndex.getPageId()); if (sd.subscriptions != null) { sd.subscriptions.clear(tx); sd.subscriptions.unload(tx); tx.free(sd.subscriptions.getPageId()); sd.subscriptionAcks.clear(tx); sd.subscriptionAcks.unload(tx); tx.free(sd.subscriptionAcks.getPageId()); sd.ackPositions.clear(tx); sd.ackPositions.unload(tx); tx.free(sd.ackPositions.getHeadPageId()); sd.subLocations.clear(tx); sd.subLocations.unload(tx); tx.free(sd.subLocations.getHeadPageId()); } String key = key(command.getDestination()); storedDestinations.remove(key); metadata.destinations.remove(tx, key); clearStoreStats(command.getDestination()); storeCache.remove(key(command.getDestination())); }
void updateIndex(Transaction tx, KahaRemoveDestinationCommand command, Location location) throws IOException { StoredDestination sd = getStoredDestination(command.getDestination(), tx); sd.orderIndex.remove(tx); sd.locationIndex.clear(tx); sd.locationIndex.unload(tx); tx.free(sd.locationIndex.getPageId()); sd.messageIdIndex.clear(tx); sd.messageIdIndex.unload(tx); tx.free(sd.messageIdIndex.getPageId()); if (sd.subscriptions != null) { sd.subscriptions.clear(tx); sd.subscriptions.unload(tx); tx.free(sd.subscriptions.getPageId()); sd.subscriptionAcks.clear(tx); sd.subscriptionAcks.unload(tx); tx.free(sd.subscriptionAcks.getPageId()); sd.ackPositions.clear(tx); sd.ackPositions.unload(tx); tx.free(sd.ackPositions.getHeadPageId()); sd.subLocations.clear(tx); sd.subLocations.unload(tx); tx.free(sd.subLocations.getHeadPageId()); } String key = key(command.getDestination()); storedDestinations.remove(key); metadata.destinations.remove(tx, key); clearStoreStats(command.getDestination()); storeCache.remove(key(command.getDestination())); }