Search in sources :

Example 1 with ContextDAO

use of org.openmrs.api.db.ContextDAO in project openmrs-core by openmrs.

the class Context method shutdown.

/**
 * Stops the OpenMRS System Should be called after all activity has ended and application is
 * closing
 */
public static void shutdown() {
    log.debug("Shutting down the scheduler");
    try {
        // Needs to be shutdown before Hibernate
        SchedulerUtil.shutdown();
    } catch (Exception e) {
        log.warn("Error while shutting down scheduler service", e);
    }
    log.debug("Shutting down the modules");
    try {
        ModuleUtil.shutdown();
    } catch (Exception e) {
        log.warn("Error while shutting down module system", e);
    }
    log.debug("Shutting down the context");
    try {
        ContextDAO dao = null;
        try {
            dao = getContextDAO();
        } catch (APIException e) {
        // pass
        }
        if (dao != null) {
            dao.shutdown();
        }
    } catch (Exception e) {
        log.warn("Error while shutting down context dao", e);
    }
}
Also used : ContextDAO(org.openmrs.api.db.ContextDAO) APIException(org.openmrs.api.APIException) DatabaseUpdateException(org.openmrs.util.DatabaseUpdateException) InputRequiredException(org.openmrs.util.InputRequiredException) APIException(org.openmrs.api.APIException) ModuleMustStartException(org.openmrs.module.ModuleMustStartException) MessageException(org.openmrs.notification.MessageException)

Aggregations

APIException (org.openmrs.api.APIException)1 ContextDAO (org.openmrs.api.db.ContextDAO)1 ModuleMustStartException (org.openmrs.module.ModuleMustStartException)1 MessageException (org.openmrs.notification.MessageException)1 DatabaseUpdateException (org.openmrs.util.DatabaseUpdateException)1 InputRequiredException (org.openmrs.util.InputRequiredException)1