Search in sources :

Example 1 with JDBCJournalStorageManager

use of org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager 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)

Example 2 with JDBCJournalStorageManager

use of org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager in project activemq-artemis by apache.

the class ActiveMQServerImpl method createStorageManager.

/**
 * This method is protected as it may be used as a hook for creating a custom storage manager (on tests for instance)
 */
protected StorageManager createStorageManager() {
    if (configuration.isPersistenceEnabled()) {
        if (configuration.getStoreConfiguration() != null && configuration.getStoreConfiguration().getStoreType() == StoreConfiguration.StoreType.DATABASE) {
            JDBCJournalStorageManager journal = new JDBCJournalStorageManager(configuration, getCriticalAnalyzer(), getScheduledPool(), executorFactory, ioExecutorFactory, shutdownOnCriticalIO);
            this.getCriticalAnalyzer().add(journal);
            return journal;
        } else {
            // Default to File Based Storage Manager, (Legacy default configuration).
            JournalStorageManager journal = new JournalStorageManager(configuration, getCriticalAnalyzer(), executorFactory, scheduledPool, ioExecutorFactory, shutdownOnCriticalIO);
            this.getCriticalAnalyzer().add(journal);
            return journal;
        }
    }
    return new NullStorageManager();
}
Also used : JDBCJournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager) NullStorageManager(org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager) JDBCJournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager) JournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager)

Example 3 with JDBCJournalStorageManager

use of org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager in project activemq-artemis by apache.

the class StorageManagerTestBase method createJDBCJournalStorageManager.

/**
 * @param configuration
 */
protected JDBCJournalStorageManager createJDBCJournalStorageManager(Configuration configuration) {
    JDBCJournalStorageManager jsm = new JDBCJournalStorageManager(configuration, EmptyCriticalAnalyzer.getInstance(), execFactory, execFactory, scheduledExecutorService);
    addActiveMQComponent(jsm);
    return jsm;
}
Also used : JDBCJournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager)

Aggregations

JDBCJournalStorageManager (org.apache.activemq.artemis.core.persistence.impl.journal.JDBCJournalStorageManager)3 JournalStorageManager (org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager)2 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 NullStorageManager (org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager)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