Search in sources :

Example 1 with HousekeepingExecutor

use of org.apache.qpid.server.util.HousekeepingExecutor in project qpid-broker-j by apache.

the class BrokerImpl method performActivation.

private void performActivation() {
    final DescendantScope descendantScope = getContextValue(DescendantScope.class, BROKER_FAIL_STARTUP_WITH_ERRORED_CHILD_SCOPE);
    List<ConfiguredObject<?>> failedChildren = getChildrenInState(this, State.ERRORED, descendantScope);
    if (!failedChildren.isEmpty()) {
        for (ConfiguredObject<?> o : failedChildren) {
            LOGGER.warn("{} child object '{}' of type '{}' is {}", o.getParent().getCategoryClass().getSimpleName(), o.getName(), o.getClass().getSimpleName(), State.ERRORED);
        }
        getEventLogger().message(BrokerMessages.FAILED_CHILDREN(failedChildren.toString()));
    }
    _documentationUrl = getContextValue(String.class, QPID_DOCUMENTATION_URL);
    final boolean brokerShutdownOnErroredChild = getContextValue(Boolean.class, BROKER_FAIL_STARTUP_WITH_ERRORED_CHILD);
    if (!_parent.isManagementMode() && brokerShutdownOnErroredChild && !failedChildren.isEmpty()) {
        throw new IllegalStateException(String.format("Broker context variable %s is set and the broker has %s children", BROKER_FAIL_STARTUP_WITH_ERRORED_CHILD, State.ERRORED));
    }
    updateAccessControl();
    _houseKeepingTaskExecutor = new HousekeepingExecutor("broker-" + getName() + "-pool", getHousekeepingThreadCount(), getSystemTaskSubject("Housekeeping", _principal));
    initialiseStatisticsReporting();
    scheduleDirectMemoryCheck();
    _assignTargetSizeSchedulingFuture = scheduleHouseKeepingTask(getHousekeepingCheckPeriod(), TimeUnit.MILLISECONDS, this::assignTargetSizes);
    final PreferenceStoreUpdaterImpl updater = new PreferenceStoreUpdaterImpl();
    final Collection<PreferenceRecord> preferenceRecords = _preferenceStore.openAndLoad(updater);
    _preferenceTaskExecutor = new TaskExecutorImpl("broker-" + getName() + "-preferences", null);
    _preferenceTaskExecutor.start();
    PreferencesRecoverer preferencesRecoverer = new PreferencesRecoverer(_preferenceTaskExecutor);
    preferencesRecoverer.recoverPreferences(this, preferenceRecords, _preferenceStore);
    if (isManagementMode()) {
        _eventLogger.message(BrokerMessages.MANAGEMENT_MODE(SystemConfig.MANAGEMENT_MODE_USER_NAME, _parent.getManagementModePassword()));
    }
    setState(State.ACTIVE);
}
Also used : HousekeepingExecutor(org.apache.qpid.server.util.HousekeepingExecutor) TaskExecutorImpl(org.apache.qpid.server.configuration.updater.TaskExecutorImpl) PreferenceRecord(org.apache.qpid.server.store.preferences.PreferenceRecord) PreferenceStoreUpdaterImpl(org.apache.qpid.server.store.preferences.PreferenceStoreUpdaterImpl) PreferencesRecoverer(org.apache.qpid.server.store.preferences.PreferencesRecoverer)

Aggregations

TaskExecutorImpl (org.apache.qpid.server.configuration.updater.TaskExecutorImpl)1 PreferenceRecord (org.apache.qpid.server.store.preferences.PreferenceRecord)1 PreferenceStoreUpdaterImpl (org.apache.qpid.server.store.preferences.PreferenceStoreUpdaterImpl)1 PreferencesRecoverer (org.apache.qpid.server.store.preferences.PreferencesRecoverer)1 HousekeepingExecutor (org.apache.qpid.server.util.HousekeepingExecutor)1