@Override public Queue getQueue() { return subscription.getQueue(); }
private void deliverIfNecessary(Collection<PageSubscription> cursorList, long minPage) { boolean currentWriting = minPage == pagingStore.getCurrentWritingPage() ? true : false; for (PageSubscription cursor : cursorList) { long firstPage = cursor.getFirstPage(); if (firstPage == minPage) { /** * if first page is current writing page and it's not complete, or * first page is before the current writing page, we need to trigger * deliverAsync to delete messages in the pages. */ if (cursor.getQueue().getMessageCount() == 0 && (!currentWriting || !cursor.isComplete(firstPage))) { cursor.getQueue().deliverAsync(); break; } } } }
logger.trace("Replacing page-counter record = " + recordID + " by record = " + newRecordID + " on subscriptionID = " + this.subscriptionID + " for queue = " + this.subscription.getQueue().getName());
/** * Delete everything associated with any queue on this address. * This is to be called when the address is about to be released from paging. * Hence the PagingStore will be holding a write lock, meaning no messages are going to be paged at this time. * So, we shouldn't lock anything after this method, to avoid dead locks between the writeLock and any synchronization with the CursorProvider. */ @Override public void onPageModeCleared() { ArrayList<PageSubscription> subscriptions = cloneSubscriptions(); Transaction tx = new TransactionImpl(storageManager); for (PageSubscription sub : subscriptions) { try { sub.onPageModeCleared(tx); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorCleaningPagingOnQueue(e, sub.getQueue().getName().toString()); } } try { tx.commit(); } catch (Exception e) { ActiveMQServerLogger.LOGGER.errorCleaningPagingDuringCommit(e); } }