Please create jars in the branch using the attached patch, and test it out in the environment where this issue occurred.
Index: javax.cache/src/main/java/org/wso2/carbon/caching/impl/DataHolder.java =================================================================== --- javax.cache/src/main/java/org/wso2/carbon/caching/impl/DataHolder.java (revision 180096) +++ javax.cache/src/main/java/org/wso2/carbon/caching/impl/DataHolder.java (working copy) @@ -49,6 +49,8 @@ try { if(distributedMapProvider != null){ cachingProvider.switchToDistributedMode(); + } else { + cachingProvider.switchToLocalMode(); } } catch (Exception e) { log.error("Cannot setDistributedMapProvider", e); Index: javax.cache/src/main/java/org/wso2/carbon/caching/impl/CacheManagerFactoryImpl.java =================================================================== --- javax.cache/src/main/java/org/wso2/carbon/caching/impl/CacheManagerFactoryImpl.java (revision 180096) +++ javax.cache/src/main/java/org/wso2/carbon/caching/impl/CacheManagerFactoryImpl.java (working copy) @@ -72,6 +72,14 @@ } } + void switchToLocalMode(){ + for (Map<String, CacheManager> cacheManagerMap : globalCacheManagerMap.values()) { + for (CacheManager cacheManager : cacheManagerMap.values()) { + ((CarbonCacheManager) cacheManager).switchToLocalMode(); + } + } + } + @Override public CacheManager getCacheManager(String cacheManagerName) { String tenantDomain = Util.getTenantDomain(); Index: javax.cache/src/main/java/org/wso2/carbon/caching/impl/CarbonCacheManager.java =================================================================== --- javax.cache/src/main/java/org/wso2/carbon/caching/impl/CarbonCacheManager.java (revision 180096) +++ javax.cache/src/main/java/org/wso2/carbon/caching/impl/CarbonCacheManager.java (working copy) @@ -131,6 +131,12 @@ } } + void switchToLocalMode(){ + for (Cache<?, ?> cache : caches.values()) { + ((CacheImpl) cache).switchToLocalMode(); + } + } + @SuppressWarnings("unchecked") final <K, V> Cache<K, V> getExistingCache(String cacheName) { touch(); Index: javax.cache/src/main/java/org/wso2/carbon/caching/impl/CacheImpl.java =================================================================== --- javax.cache/src/main/java/org/wso2/carbon/caching/impl/CacheImpl.java (revision 180202) +++ javax.cache/src/main/java/org/wso2/carbon/caching/impl/CacheImpl.java (working copy) @@ -150,6 +150,15 @@ } } + void switchToLocalMode() { + DistributedMapProvider distributedMapProvider = + DataHolder.getInstance().getDistributedMapProvider(); + if (isLocalCache(cacheName, distributedMapProvider)) { + return; + } + isLocalCache = true; + } + private String getMapName(String cacheName, CacheManager cacheManager) { return "$cache.$domain[" + ownerTenantDomain + "]" + cacheManager.getName() + "#" + cacheName; Index: javax.cache/src/main/java/org/wso2/carbon/caching/impl/CachingProviderImpl.java =================================================================== --- javax.cache/src/main/java/org/wso2/carbon/caching/impl/CachingProviderImpl.java (revision 180096) +++ javax.cache/src/main/java/org/wso2/carbon/caching/impl/CachingProviderImpl.java (working copy) @@ -35,6 +35,10 @@ cacheManagerFactory.switchToDistributedMode(); } + void switchToLocalMode(){ + cacheManagerFactory.switchToLocalMode(); + } + @Override public CacheManagerFactory getCacheManagerFactory() { return cacheManagerFactory; Index: org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/clustering/hazelcast/HazelcastClusteringAgent.java =================================================================== --- org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/clustering/hazelcast/HazelcastClusteringAgent.java (revision 181419) +++ org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/clustering/hazelcast/HazelcastClusteringAgent.java (working copy) @@ -44,6 +44,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; import org.wso2.carbon.caching.impl.DistributedMapProvider; import org.wso2.carbon.core.ServerStatus; import org.wso2.carbon.core.clustering.api.CarbonCluster; @@ -107,6 +108,7 @@ new HashMap<String, Map<String, GroupManagementAgent>>(); private boolean clusterManagementMode; private String primaryDomain; + private ServiceRegistration<DistributedMapProvider> distributedMapProviderServiceRegistration; public void init() throws ClusteringFault { MemberUtils.init(parameters, configurationContext); @@ -220,11 +222,11 @@ } MemberUtils.getMembersMap(primaryHazelcastInstance, primaryDomain).put(localMember.getUuid(), carbonLocalMember); - BundleContext bundleContext = CarbonCoreDataHolder.getInstance(). - getBundleContext(); - bundleContext.registerService(DistributedMapProvider.class, - new HazelcastDistributedMapProvider(primaryHazelcastInstance), - null); + BundleContext bundleContext = CarbonCoreDataHolder.getInstance().getBundleContext(); + distributedMapProviderServiceRegistration = + bundleContext.registerService(DistributedMapProvider.class, + new HazelcastDistributedMapProvider(primaryHazelcastInstance), + null); bundleContext.registerService(HazelcastInstance.class, primaryHazelcastInstance, null); bundleContext.registerService(CarbonCluster.class, hazelcastCarbonCluster, null); @@ -373,6 +375,8 @@ public void shutdown() throws ClusteringFault { try { Hazelcast.shutdownAll(); + // Unregister the DistributedMapProvider + distributedMapProviderServiceRegistration.unregister(); } catch (Exception ignored) { } } Index: org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HouseKeepingTask.java =================================================================== --- org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HouseKeepingTask.java (revision 180199) +++ org.wso2.carbon.core/src/main/java/org/wso2/carbon/core/util/HouseKeepingTask.java (working copy) @@ -72,10 +72,11 @@ } File[] children = file.listFiles(); if (children != null) { - for (int i = 0; i < children.length; i++) { - clean(children[i], deletedFiles); + for (File child : children) { + clean(child, deletedFiles); } - if (file.listFiles() == null || file.listFiles().length == 0) { // all children deleted? + children = file.listFiles(); + if (children == null || children.length == 0) { // all children deleted? String absPath = file.getAbsolutePath(); if (log.isDebugEnabled()) { log.debug("Deleting directory " + absPath + "...");
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev