Search in sources :

Example 1 with TaskManagerConfigurationException

use of com.evolveum.midpoint.task.api.TaskManagerConfigurationException in project midpoint by Evolveum.

the class TaskManagerConfiguration method setBasicInformation.

void setBasicInformation(MidpointConfiguration masterConfig) throws TaskManagerConfigurationException {
    Configuration c = masterConfig.getConfiguration(TASK_MANAGER_CONFIG_SECTION);
    stopOnInitializationFailure = c.getBoolean(STOP_ON_INITIALIZATION_FAILURE_CONFIG_ENTRY, STOP_ON_INITIALIZATION_FAILURE_DEFAULT);
    threads = c.getInt(THREADS_CONFIG_ENTRY, THREADS_DEFAULT);
    clustered = c.getBoolean(CLUSTERED_CONFIG_ENTRY, CLUSTERED_DEFAULT);
    jdbcJobStore = c.getBoolean(JDBC_JOB_STORE_CONFIG_ENTRY, clustered);
    nodeId = System.getProperty(MIDPOINT_NODE_ID_PROPERTY);
    if (StringUtils.isEmpty(nodeId) && !clustered) {
        nodeId = NODE_ID_DEFAULT;
    }
    jmxHostName = System.getProperty(MIDPOINT_JMX_HOST_NAME_PROPERTY);
    String portString = System.getProperty(JMX_PORT_PROPERTY);
    if (StringUtils.isEmpty(portString)) {
        jmxPort = JMX_PORT_DEFAULT;
    } else {
        try {
            jmxPort = Integer.parseInt(portString);
        } catch (NumberFormatException nfe) {
            throw new TaskManagerConfigurationException("Cannot get JMX management port - invalid integer value of " + portString, nfe);
        }
    }
    jmxConnectTimeout = c.getInt(JMX_CONNECT_TIMEOUT_CONFIG_ENTRY, JMX_CONNECT_TIMEOUT_DEFAULT);
    if (c.containsKey(TEST_MODE_CONFIG_ENTRY)) {
        midPointTestMode = c.getBoolean(TEST_MODE_CONFIG_ENTRY);
        LOGGER.trace(TEST_MODE_CONFIG_ENTRY + " present, its value = " + midPointTestMode);
    } else {
        LOGGER.trace(TEST_MODE_CONFIG_ENTRY + " NOT present");
        Properties sp = System.getProperties();
        if (sp.containsKey(SUREFIRE_PRESENCE_PROPERTY)) {
            LOGGER.info("Determined to run in a test environment, setting midPointTestMode to 'true'.");
            midPointTestMode = true;
        } else {
            midPointTestMode = false;
        }
    }
    LOGGER.trace("midPointTestMode = " + midPointTestMode);
    String useTI = c.getString(USE_THREAD_INTERRUPT_CONFIG_ENTRY, USE_THREAD_INTERRUPT_DEFAULT);
    try {
        useThreadInterrupt = UseThreadInterrupt.fromValue(useTI);
    } catch (IllegalArgumentException e) {
        throw new TaskManagerConfigurationException("Illegal value for " + USE_THREAD_INTERRUPT_CONFIG_ENTRY + ": " + useTI, e);
    }
    quartzNodeRegistrationCycleTime = c.getInt(QUARTZ_NODE_REGISTRATION_INTERVAL_CONFIG_ENTRY, QUARTZ_NODE_REGISTRATION_CYCLE_TIME_DEFAULT);
    nodeRegistrationCycleTime = c.getInt(NODE_REGISTRATION_INTERVAL_CONFIG_ENTRY, NODE_REGISTRATION_CYCLE_TIME_DEFAULT);
    nodeTimeout = c.getInt(NODE_TIMEOUT_CONFIG_ENTRY, NODE_TIMEOUT_DEFAULT);
    jmxUsername = c.getString(JMX_USERNAME_CONFIG_ENTRY, JMX_USERNAME_DEFAULT);
    jmxPassword = c.getString(JMX_PASSWORD_CONFIG_ENTRY, JMX_PASSWORD_DEFAULT);
    waitingTasksCheckInterval = c.getInt(WAITING_TASKS_CHECK_INTERVAL_CONFIG_ENTRY, WAITING_TASKS_CHECK_INTERVAL_DEFAULT);
    stalledTasksCheckInterval = c.getInt(STALLED_TASKS_CHECK_INTERVAL_CONFIG_ENTRY, STALLED_TASKS_CHECK_INTERVAL_DEFAULT);
    stalledTasksThreshold = c.getInt(STALLED_TASKS_THRESHOLD_CONFIG_ENTRY, STALLED_TASKS_THRESHOLD_DEFAULT);
    stalledTasksRepeatedNotificationInterval = c.getInt(STALLED_TASKS_REPEATED_NOTIFICATION_INTERVAL_CONFIG_ENTRY, STALLED_TASKS_REPEATED_NOTIFICATION_INTERVAL_DEFAULT);
    runNowKeepsOriginalSchedule = c.getBoolean(RUN_NOW_KEEPS_ORIGINAL_SCHEDULE_CONFIG_ENTRY, RUN_NOW_KEEPS_ORIGINAL_SCHEDULE_DEFAULT);
    schedulerInitiallyStopped = c.getBoolean(SCHEDULER_INITIALLY_STOPPED_CONFIG_ENTRY, false);
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) Configuration(org.apache.commons.configuration.Configuration) SqlRepositoryConfiguration(com.evolveum.midpoint.repo.sql.SqlRepositoryConfiguration) TaskManagerConfigurationException(com.evolveum.midpoint.task.api.TaskManagerConfigurationException) Properties(java.util.Properties)

Aggregations

MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)1 SqlRepositoryConfiguration (com.evolveum.midpoint.repo.sql.SqlRepositoryConfiguration)1 TaskManagerConfigurationException (com.evolveum.midpoint.task.api.TaskManagerConfigurationException)1 Properties (java.util.Properties)1 Configuration (org.apache.commons.configuration.Configuration)1