Search in sources :

Example 1 with LocalGroupingHandler

use of org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler in project activemq-artemis by apache.

the class ActiveMQServerImpl method deployGroupingHandlerConfiguration.

private void deployGroupingHandlerConfiguration(final GroupingHandlerConfiguration config) throws Exception {
    if (config != null) {
        GroupingHandler groupingHandler1;
        if (config.getType() == GroupingHandlerConfiguration.TYPE.LOCAL) {
            groupingHandler1 = new LocalGroupingHandler(executorFactory, scheduledPool, managementService, config.getName(), config.getAddress(), getStorageManager(), config.getTimeout(), config.getGroupTimeout(), config.getReaperPeriod());
        } else {
            groupingHandler1 = new RemoteGroupingHandler(executorFactory, managementService, config.getName(), config.getAddress(), config.getTimeout(), config.getGroupTimeout());
        }
        this.groupingHandler = groupingHandler1;
        managementService.addNotificationListener(groupingHandler1);
    }
}
Also used : LocalGroupingHandler(org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler) LocalGroupingHandler(org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler) RemoteGroupingHandler(org.apache.activemq.artemis.core.server.group.impl.RemoteGroupingHandler) GroupingHandler(org.apache.activemq.artemis.core.server.group.GroupingHandler) RemoteGroupingHandler(org.apache.activemq.artemis.core.server.group.impl.RemoteGroupingHandler)

Example 2 with LocalGroupingHandler

use of org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler 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

LocalGroupingHandler (org.apache.activemq.artemis.core.server.group.impl.LocalGroupingHandler)2 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 GroupingHandler (org.apache.activemq.artemis.core.server.group.GroupingHandler)1 RemoteGroupingHandler (org.apache.activemq.artemis.core.server.group.impl.RemoteGroupingHandler)1 ActiveMQPluginRunnable (org.apache.activemq.artemis.core.server.plugin.ActiveMQPluginRunnable)1