public synchronized void start() throws Exception { if (!started) { //fix to prevent page table names to be longer than 30 chars (upper limit for Oracle12c identifiers length) final String pageStoreTableNamePrefix = dbConf.getPageStoreTableName(); if (pageStoreTableNamePrefix.length() > 10) { throw new IllegalStateException("The maximum name size for the page store table prefix is 10 characters: THE PAGING STORE CAN'T START"); } if (dbConf.getDataSource() != null) { SQLProvider.Factory sqlProviderFactory = dbConf.getSqlProviderFactory(); if (sqlProviderFactory == null) { sqlProviderFactory = new PropertySQLProvider.Factory(dbConf.getDataSource()); } pagingFactoryFileFactory = new JDBCSequentialFileFactory(dbConf.getDataSource(), sqlProviderFactory.create(pageStoreTableNamePrefix, SQLProvider.DatabaseStoreType.PAGE), executorFactory.getExecutor(), criticalErrorListener); } else { String driverClassName = dbConf.getJdbcDriverClassName(); pagingFactoryFileFactory = new JDBCSequentialFileFactory(dbConf.getJdbcConnectionUrl(), driverClassName, JDBCUtils.getSQLProvider(driverClassName, pageStoreTableNamePrefix, SQLProvider.DatabaseStoreType.PAGE), executorFactory.getExecutor(), criticalErrorListener); } final int jdbcNetworkTimeout = dbConf.getJdbcNetworkTimeout(); if (jdbcNetworkTimeout >= 0) { pagingFactoryFileFactory.setNetworkTimeout(this.executorFactory.getExecutor(), jdbcNetworkTimeout); } pagingFactoryFileFactory.start(); started = true; } } // Public --------------------------------------------------------
IOCriticalErrorListener ioCriticalErrorListener) { validateTimeoutConfiguration(configuration); if (configuration.getDataSource() != null) { final SQLProvider.Factory sqlProviderFactory; if (configuration.getSqlProviderFactory() != null) { sqlProviderFactory = configuration.getSqlProviderFactory(); } else { sqlProviderFactory = new PropertySQLProvider.Factory(configuration.getDataSource()); configuration.getJdbcLockRenewPeriodMillis(), configuration.getJdbcLockAcquisitionTimeoutMillis(), configuration.getDataSource(), sqlProviderFactory.create(configuration.getNodeManagerStoreTableName(), SQLProvider.DatabaseStoreType.NODE_MANAGER), scheduledExecutorService,
private synchronized SequentialFileFactory newFileFactory(final String directoryName, boolean writeToDirectory) throws Exception { JDBCSequentialFile directoryList = (JDBCSequentialFile) pagingFactoryFileFactory.createSequentialFile(DIRECTORY_NAME); directoryList.open(); SimpleString simpleString = SimpleString.toSimpleString(directoryName); ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(simpleString.sizeof()); buffer.writeSimpleString(simpleString); if (writeToDirectory) directoryList.write(buffer, true); directoryList.close(); final SQLProvider sqlProvider; if (dbConf.getDataSource() != null) { final SQLProvider.Factory sqlProviderFactory; if (dbConf.getSqlProviderFactory() != null) { sqlProviderFactory = dbConf.getSqlProviderFactory(); } else { sqlProviderFactory = new PropertySQLProvider.Factory(dbConf.getDataSource()); } sqlProvider = sqlProviderFactory.create(getTableNameForGUID(directoryName), SQLProvider.DatabaseStoreType.PAGE); } else { sqlProvider = JDBCUtils.getSQLProvider(dbConf.getJdbcDriverClassName(), getTableNameForGUID(directoryName), SQLProvider.DatabaseStoreType.PAGE); } final JDBCSequentialFileFactory fileFactory = new JDBCSequentialFileFactory(pagingFactoryFileFactory.getDbDriver().getConnection(), sqlProvider, executorFactory.getExecutor(), criticalErrorListener); final int jdbcNetworkTimeout = dbConf.getJdbcNetworkTimeout(); if (jdbcNetworkTimeout >= 0) { fileFactory.setNetworkTimeout(this.executorFactory.getExecutor(), jdbcNetworkTimeout); } factoryToTableName.put(fileFactory, directoryName); return fileFactory; }
final JDBCJournalImpl messageJournal; final JDBCSequentialFileFactory largeMessagesFactory; if (dbConf.getDataSource() != null) { SQLProvider.Factory sqlProviderFactory = dbConf.getSqlProviderFactory(); if (sqlProviderFactory == null) { sqlProviderFactory = new PropertySQLProvider.Factory(dbConf.getDataSource()); bindingsJournal = new JDBCJournalImpl(dbConf.getDataSource(), sqlProviderFactory.create(dbConf.getBindingsTableName(), SQLProvider.DatabaseStoreType.BINDINGS_JOURNAL), scheduledExecutorService, executorFactory.getExecutor(), criticalErrorListener,dbConf.getJdbcJournalSyncPeriodMillis()); messageJournal = new JDBCJournalImpl(dbConf.getDataSource(), sqlProviderFactory.create(dbConf.getMessageTableName(), SQLProvider.DatabaseStoreType.MESSAGE_JOURNAL), scheduledExecutorService, executorFactory.getExecutor(), criticalErrorListener, dbConf.getJdbcJournalSyncPeriodMillis()); largeMessagesFactory = new JDBCSequentialFileFactory(dbConf.getDataSource(), sqlProviderFactory.create(dbConf.getLargeMessageTableName(), SQLProvider.DatabaseStoreType.LARGE_MESSAGE), executorFactory.getExecutor(), criticalErrorListener); } else { String driverClassName = dbConf.getJdbcDriverClassName();