use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.
the class PostOfficeImpl method setPagingStore.
// Private -----------------------------------------------------------------
private void setPagingStore(SimpleString address, Message message) throws Exception {
PagingStore store = pagingManager.getPageStore(address);
message.setContext(store);
}
use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.
the class AbstractJournalStorageManager method locateSubscription.
/**
* @param queueID
* @param pageSubscriptions
* @param queueInfos
* @return
*/
private static PageSubscription locateSubscription(final long queueID, final Map<Long, PageSubscription> pageSubscriptions, final Map<Long, QueueBindingInfo> queueInfos, final PagingManager pagingManager) throws Exception {
PageSubscription subs = pageSubscriptions.get(queueID);
if (subs == null) {
QueueBindingInfo queueInfo = queueInfos.get(queueID);
if (queueInfo != null) {
SimpleString address = queueInfo.getAddress();
PagingStore store = pagingManager.getPageStore(address);
subs = store.getCursorProvider().getSubscription(queueID);
pageSubscriptions.put(queueID, subs);
}
}
return subs;
}
use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.
the class JournalStorageManager method getPageInformationForSync.
/**
* @param pagingManager
* @return
* @throws Exception
*/
private Map<SimpleString, Collection<Integer>> getPageInformationForSync(PagingManager pagingManager) throws Exception {
Map<SimpleString, Collection<Integer>> info = new HashMap<>();
for (SimpleString storeName : pagingManager.getStoreNames()) {
PagingStore store = pagingManager.getPageStore(storeName);
info.put(storeName, store.getCurrentIds());
store.forceAnotherPage();
}
return info;
}
use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.
the class JournalStorageManager method sendPagesToBackup.
/**
* @param pageFilesToSync
* @throws Exception
*/
private void sendPagesToBackup(Map<SimpleString, Collection<Integer>> pageFilesToSync, PagingManager manager) throws Exception {
for (Map.Entry<SimpleString, Collection<Integer>> entry : pageFilesToSync.entrySet()) {
if (!started)
return;
PagingStore store = manager.getPageStore(entry.getKey());
store.sendPages(replicator, entry.getValue());
}
}
use of org.apache.activemq.artemis.core.paging.PagingStore in project activemq-artemis by apache.
the class PagingStoreFactoryDatabase method reloadStores.
@Override
public synchronized List<PagingStore> reloadStores(final HierarchicalRepository<AddressSettings> addressSettingsRepository) throws Exception {
// We assume the directory list < Integer.MAX_VALUE (this is only a list of addresses).
JDBCSequentialFile directoryList = (JDBCSequentialFile) pagingFactoryFileFactory.createSequentialFile(DIRECTORY_NAME);
directoryList.open();
int size = ((Long) directoryList.size()).intValue();
ActiveMQBuffer buffer = readActiveMQBuffer(directoryList, size);
ArrayList<PagingStore> storesReturn = new ArrayList<>();
while (buffer.readableBytes() > 0) {
SimpleString table = buffer.readSimpleString();
JDBCSequentialFileFactory factory = (JDBCSequentialFileFactory) newFileFactory(table.toString(), false);
factory.start();
JDBCSequentialFile addressFile = (JDBCSequentialFile) factory.createSequentialFile(ADDRESS_FILE);
addressFile.open();
size = ((Long) addressFile.size()).intValue();
if (size == 0) {
continue;
}
ActiveMQBuffer addrBuffer = readActiveMQBuffer(addressFile, size);
SimpleString address = addrBuffer.readSimpleString();
AddressSettings settings = addressSettingsRepository.getMatch(address.toString());
PagingStore store = new PagingStoreImpl(address, scheduledExecutor, syncTimeout, pagingManager, storageManager, factory, this, address, settings, executorFactory.getExecutor(), syncNonTransactional);
storesReturn.add(store);
}
directoryList.close();
return storesReturn;
}
Aggregations