Search in sources :

Example 1 with PagingStoreFactoryDatabase

use of org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryDatabase in project activemq-artemis by apache.

the class DBOption method initializeJournal.

protected void initializeJournal(Configuration configuration) throws Exception {
    this.config = configuration;
    executor = Executors.newFixedThreadPool(5, ActiveMQThreadFactory.defaultThreadFactory());
    executorFactory = new OrderedExecutorFactory(executor);
    scheduledExecutorService = new ScheduledThreadPoolExecutor(configuration.getScheduledThreadPoolMaxSize(), new ThreadFactory() {

        @Override
        public Thread newThread(Runnable r) {
            return new Thread(r);
        }
    });
    HierarchicalRepository<AddressSettings> addressSettingsRepository = new HierarchicalObjectRepository<>(config.getWildcardConfiguration());
    addressSettingsRepository.setDefault(new AddressSettings());
    if (configuration.isJDBC()) {
        storageManager = new JDBCJournalStorageManager(config, null, scheduledExecutorService, executorFactory, executorFactory, null);
        PagingStoreFactory pageStoreFactory = new PagingStoreFactoryDatabase((DatabaseStorageConfiguration) configuration.getStoreConfiguration(), storageManager, 1000L, scheduledExecutorService, executorFactory, false, null);
        pagingmanager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository);
    } else {
        storageManager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), executorFactory, executorFactory);
        PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(storageManager, config.getPagingLocation(), 1000L, scheduledExecutorService, executorFactory, true, null);
        pagingmanager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository);
    }
}
Also used : ThreadFactory(java.util.concurrent.ThreadFactory) ActiveMQThreadFactory(org.apache.activemq.artemis.utils.ActiveMQThreadFactory) AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) JDBCJournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager) OrderedExecutorFactory(org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) PagingStoreFactoryDatabase(org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryDatabase) HierarchicalObjectRepository(org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository) JDBCJournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager) JournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager) PagingStoreFactoryNIO(org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryNIO) PagingStoreFactory(org.apache.activemq.artemis.core.paging.PagingStoreFactory) PagingManagerImpl(org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl)

Aggregations

ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 PagingStoreFactory (org.apache.activemq.artemis.core.paging.PagingStoreFactory)1 PagingManagerImpl (org.apache.activemq.artemis.core.paging.impl.PagingManagerImpl)1 PagingStoreFactoryDatabase (org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryDatabase)1 PagingStoreFactoryNIO (org.apache.activemq.artemis.core.paging.impl.PagingStoreFactoryNIO)1 JDBCJournalStorageManager (org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager)1 JournalStorageManager (org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager)1 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)1 HierarchicalObjectRepository (org.apache.activemq.artemis.core.settings.impl.HierarchicalObjectRepository)1 ActiveMQThreadFactory (org.apache.activemq.artemis.utils.ActiveMQThreadFactory)1 OrderedExecutorFactory (org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory)1