Search in sources :

Example 1 with ThrottlePolicyStartupListener

use of org.wso2.carbon.apimgt.throttle.policy.deployer.utils.ThrottlePolicyStartupListener in project carbon-apimgt by wso2.

the class ThrottlePolicyDeployerComponent method activate.

@Activate
protected void activate(ComponentContext context) {
    log.debug("Activating component...");
    APIManagerConfiguration configuration = ServiceReferenceHolder.getInstance().getAPIMConfiguration();
    if (configuration == null) {
        log.warn("API Manager Configuration not properly set.");
        return;
    }
    ThrottleProperties throttleProperties = configuration.getThrottleProperties();
    if (throttleProperties.isEnablePolicyDeployment()) {
        ThrottlePolicyStartupListener throttlePolicyStartupListener = new ThrottlePolicyStartupListener();
        registration = context.getBundleContext().registerService(ServerStartupObserver.class, throttlePolicyStartupListener, null);
        registration = context.getBundleContext().registerService(ServerShutdownHandler.class, throttlePolicyStartupListener, null);
        registration = context.getBundleContext().registerService(JMSListenerShutDownService.class, throttlePolicyStartupListener, null);
    }
}
Also used : ServerStartupObserver(org.wso2.carbon.core.ServerStartupObserver) APIManagerConfiguration(org.wso2.carbon.apimgt.impl.APIManagerConfiguration) JMSListenerShutDownService(org.wso2.carbon.apimgt.impl.jms.listener.JMSListenerShutDownService) ThrottlePolicyStartupListener(org.wso2.carbon.apimgt.throttle.policy.deployer.utils.ThrottlePolicyStartupListener) ServerShutdownHandler(org.wso2.carbon.core.ServerShutdownHandler) ThrottleProperties(org.wso2.carbon.apimgt.impl.dto.ThrottleProperties) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Activate (org.osgi.service.component.annotations.Activate)1 APIManagerConfiguration (org.wso2.carbon.apimgt.impl.APIManagerConfiguration)1 ThrottleProperties (org.wso2.carbon.apimgt.impl.dto.ThrottleProperties)1 JMSListenerShutDownService (org.wso2.carbon.apimgt.impl.jms.listener.JMSListenerShutDownService)1 ThrottlePolicyStartupListener (org.wso2.carbon.apimgt.throttle.policy.deployer.utils.ThrottlePolicyStartupListener)1 ServerShutdownHandler (org.wso2.carbon.core.ServerShutdownHandler)1 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)1