Search in sources :

Example 1 with APIMgtServerStartupListener

use of org.wso2.carbon.apimgt.cache.invalidation.APIMgtServerStartupListener in project carbon-apimgt by wso2.

the class CacheInvalidationServiceComponent method activate.

@Activate
protected void activate(ComponentContext context) {
    CacheInvalidationConfiguration cacheInvalidationConfiguration;
    BundleContext bundleContext = context.getBundleContext();
    if (DataHolder.getInstance().getAPIManagerConfigurationService() != null) {
        cacheInvalidationConfiguration = DataHolder.getInstance().getAPIManagerConfigurationService().getAPIManagerConfiguration().getCacheInvalidationConfiguration();
        if (cacheInvalidationConfiguration.isEnabled()) {
            APIMgtCacheInvalidationRequestSender apiMgtCacheInvalidationRequestSender = new APIMgtCacheInvalidationRequestSender(cacheInvalidationConfiguration);
            cacheInvalidationRequestSenderServiceRegistration = bundleContext.registerService(CacheInvalidationRequestSender.class, apiMgtCacheInvalidationRequestSender, null);
            cacheInvalidationRequestSenderServiceRegistration = bundleContext.registerService(CacheEntryListener.class, apiMgtCacheInvalidationRequestSender, null);
            APIMgtServerStartupListener apimgtCacheInvalidationServerStartupListener = new APIMgtServerStartupListener();
            cacheInvalidationRequestSenderServiceRegistration = bundleContext.registerService(ServerStartupObserver.class, apimgtCacheInvalidationServerStartupListener, null);
            cacheInvalidationRequestSenderServiceRegistration = bundleContext.registerService(ServerShutdownHandler.class, apimgtCacheInvalidationServerStartupListener, null);
            cacheInvalidationRequestSenderServiceRegistration = bundleContext.registerService(JMSListenerShutDownService.class, apimgtCacheInvalidationServerStartupListener, null);
        }
    }
}
Also used : ServerStartupObserver(org.wso2.carbon.core.ServerStartupObserver) CacheEntryListener(javax.cache.event.CacheEntryListener) JMSListenerShutDownService(org.wso2.carbon.apimgt.impl.jms.listener.JMSListenerShutDownService) CacheInvalidationConfiguration(org.wso2.carbon.apimgt.impl.CacheInvalidationConfiguration) ServerShutdownHandler(org.wso2.carbon.core.ServerShutdownHandler) APIMgtCacheInvalidationRequestSender(org.wso2.carbon.apimgt.cache.invalidation.APIMgtCacheInvalidationRequestSender) APIMgtCacheInvalidationRequestSender(org.wso2.carbon.apimgt.cache.invalidation.APIMgtCacheInvalidationRequestSender) CacheInvalidationRequestSender(javax.cache.CacheInvalidationRequestSender) APIMgtServerStartupListener(org.wso2.carbon.apimgt.cache.invalidation.APIMgtServerStartupListener) BundleContext(org.osgi.framework.BundleContext) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

CacheInvalidationRequestSender (javax.cache.CacheInvalidationRequestSender)1 CacheEntryListener (javax.cache.event.CacheEntryListener)1 BundleContext (org.osgi.framework.BundleContext)1 Activate (org.osgi.service.component.annotations.Activate)1 APIMgtCacheInvalidationRequestSender (org.wso2.carbon.apimgt.cache.invalidation.APIMgtCacheInvalidationRequestSender)1 APIMgtServerStartupListener (org.wso2.carbon.apimgt.cache.invalidation.APIMgtServerStartupListener)1 CacheInvalidationConfiguration (org.wso2.carbon.apimgt.impl.CacheInvalidationConfiguration)1 JMSListenerShutDownService (org.wso2.carbon.apimgt.impl.jms.listener.JMSListenerShutDownService)1 ServerShutdownHandler (org.wso2.carbon.core.ServerShutdownHandler)1 ServerStartupObserver (org.wso2.carbon.core.ServerStartupObserver)1