Search in sources :

Example 1 with FileStoreMonitor

use of org.apache.activemq.artemis.core.server.files.FileStoreMonitor in project activemq-artemis by apache.

the class ActiveMQServerImpl method initialisePart2.

/*
    * Load the data, and start remoting service so clients can connect
    */
synchronized void initialisePart2(boolean scalingDown) throws Exception {
    if (state == SERVER_STATE.STOPPED || state == SERVER_STATE.STOPPING) {
        return;
    }
    pagingManager.reloadStores();
    JournalLoadInformation[] journalInfo = loadJournals();
    final ServerInfo dumper = new ServerInfo(this, pagingManager);
    long dumpInfoInterval = configuration.getServerDumpInterval();
    if (dumpInfoInterval > 0) {
        scheduledPool.scheduleWithFixedDelay(new Runnable() {

            @Override
            public void run() {
                ActiveMQServerLogger.LOGGER.dumpServerInfo(dumper.dump());
            }
        }, 0, dumpInfoInterval, TimeUnit.MILLISECONDS);
    }
    // Deploy the rest of the stuff
    // Deploy predefined addresses
    deployAddressesFromConfiguration();
    // Deploy any predefined queues
    deployQueuesFromConfiguration();
    // Undeploy any addresses and queues not in config
    undeployAddressesAndQueueNotInConfiguration();
    // We need to call this here, this gives any dependent server a chance to deploy its own addresses
    // this needs to be done before clustering is fully activated
    callActivateCallbacks();
    checkForPotentialOOMEInAddressConfiguration();
    if (!scalingDown) {
        // Deploy any pre-defined diverts
        deployDiverts();
        if (groupingHandler != null) {
            groupingHandler.start();
        }
        if (groupingHandler != null && groupingHandler instanceof LocalGroupingHandler) {
            clusterManager.start();
            groupingHandler.awaitBindings();
            remotingService.start();
        } else {
            remotingService.start();
            clusterManager.start();
        }
        if (nodeManager.getNodeId() == null) {
            throw ActiveMQMessageBundle.BUNDLE.nodeIdNull();
        }
        // We can only do this after everything is started otherwise we may get nasty races with expired messages
        postOffice.startExpiryScanner();
    }
    if (configuration.getMaxDiskUsage() != -1) {
        try {
            injectMonitor(new FileStoreMonitor(getScheduledPool(), executorFactory.getExecutor(), configuration.getDiskScanPeriod(), TimeUnit.MILLISECONDS, configuration.getMaxDiskUsage() / 100f, shutdownOnCriticalIO));
        } catch (Exception e) {
            ActiveMQServerLogger.LOGGER.unableToInjectMonitor(e);
        }
    }
}
Also used : JournalLoadInformation(org.apache.activemq.artemis.core.journal.JournalLoadInformation) LocalGroupingHandler(org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler) ActiveMQPluginRunnable(org.apache.activemq.artemis.core.server.plugin.ActiveMQPluginRunnable) FileStoreMonitor(org.apache.activemq.artemis.core.server.files.FileStoreMonitor) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) IOException(java.io.IOException) ActiveMQQueueExistsException(org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException) ActiveMQDeleteAddressException(org.apache.activemq.artemis.api.core.ActiveMQDeleteAddressException)

Aggregations

IOException (java.io.IOException)1 ActiveMQDeleteAddressException (org.apache.activemq.artemis.api.core.ActiveMQDeleteAddressException)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ActiveMQQueueExistsException (org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException)1 JournalLoadInformation (org.apache.activemq.artemis.core.journal.JournalLoadInformation)1 FileStoreMonitor (org.apache.activemq.artemis.core.server.files.FileStoreMonitor)1 LocalGroupingHandler (org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler)1 ActiveMQPluginRunnable (org.apache.activemq.artemis.core.server.plugin.ActiveMQPluginRunnable)1