All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lontime.extspring.components.StartupComponentExt Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
package com.github.lontime.extspring.components;

import java.util.List;

import org.springframework.beans.factory.SmartInitializingSingleton;

import com.github.lontime.base.commonj.components.ActiveComponents;
import com.github.lontime.base.commonj.components.ComponentLifecycle;
import com.github.lontime.base.commonj.utils.LoggerHelper;

/**
 * StartupComponentExt.
 * @author lontime
 * @since 1.0
 */
public class StartupComponentExt implements SmartInitializingSingleton {
    @Override
    public void afterSingletonsInstantiated() {
        LoggerHelper.info(getClass(), "afterSingletonsInstantiated: total active components:{0}", ActiveComponents.size());
        final List components = ActiveComponents.getAll();
        for (ComponentLifecycle component : components) {
            component.reentrantStart();
        }
        for (ComponentLifecycle component : components) {
            if (!component.awaitRunning()) {
                LoggerHelper.warn(getClass(), "afterSingletonsInstantiated: component {0} is not running!", component.getName());
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy