cleanups and simplifications
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/89763d1c Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/89763d1c Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/89763d1c Branch: refs/heads/develop Commit: 89763d1c0c626aad9a8d8d19b99d10f0a8e466fc Parents: 2f22f5c Author: Sebastian Schaffert <[email protected]> Authored: Tue Mar 4 17:46:34 2014 +0100 Committer: Sebastian Schaffert <[email protected]> Committed: Tue Mar 4 17:46:34 2014 +0100 ---------------------------------------------------------------------- .../caching/HazelcastCacheManager.java | 9 -- .../InfinispanEmbeddedCacheManager.java | 52 ++++------ .../remote/InfinispanRemoteCacheManager.java | 15 +++ .../marmotta/kiwi/infinispan/util/AsyncMap.java | 102 +++++++++++++++++++ .../marmotta/kiwi/test/EmbeddedClusterTest.java | 37 +++++++ .../kiwi/test/InfinispanClusterTest.java | 37 ------- .../marmotta/kiwi/caching/CacheManager.java | 10 ++ .../marmotta/kiwi/config/KiWiConfiguration.java | 29 ++++-- 8 files changed, 206 insertions(+), 85 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-caching-hazelcast/src/main/java/org/apache/marmotta/kiwi/hazelcast/caching/HazelcastCacheManager.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-caching-hazelcast/src/main/java/org/apache/marmotta/kiwi/hazelcast/caching/HazelcastCacheManager.java b/libraries/kiwi/kiwi-caching-hazelcast/src/main/java/org/apache/marmotta/kiwi/hazelcast/caching/HazelcastCacheManager.java index cc037c9..b2b03a8 100644 --- a/libraries/kiwi/kiwi-caching-hazelcast/src/main/java/org/apache/marmotta/kiwi/hazelcast/caching/HazelcastCacheManager.java +++ b/libraries/kiwi/kiwi-caching-hazelcast/src/main/java/org/apache/marmotta/kiwi/hazelcast/caching/HazelcastCacheManager.java @@ -41,15 +41,6 @@ import java.util.Map; */ public class HazelcastCacheManager implements CacheManager { - public static final String TRIPLE_CACHE = "triple-cache"; - public static final String URI_CACHE = "uri-cache"; - public static final String BNODE_CACHE = "bnode-cache"; - public static final String LITERAL_CACHE = "literal-cache"; - public static final String NODE_CACHE = "node-cache"; - public static final String NS_PREFIX_CACHE = "ns-prefix-cache"; - public static final String NS_URI_CACHE = "ns-uri-cache"; - public static final String REGISTRY_CACHE = "registry-cache"; - private static Logger log = LoggerFactory.getLogger(HazelcastCacheManager.class); private KiWiConfiguration configuration; http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/embedded/InfinispanEmbeddedCacheManager.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/embedded/InfinispanEmbeddedCacheManager.java b/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/embedded/InfinispanEmbeddedCacheManager.java index 5cf5953..6076577 100644 --- a/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/embedded/InfinispanEmbeddedCacheManager.java +++ b/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/embedded/InfinispanEmbeddedCacheManager.java @@ -21,6 +21,7 @@ import org.apache.commons.io.IOUtils; import org.apache.marmotta.kiwi.caching.CacheManager; import org.apache.marmotta.kiwi.config.KiWiConfiguration; import org.apache.marmotta.kiwi.infinispan.externalizer.*; +import org.apache.marmotta.kiwi.infinispan.util.AsyncMap; import org.infinispan.Cache; import org.infinispan.commons.CacheException; import org.infinispan.commons.marshall.AdvancedExternalizer; @@ -40,6 +41,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Iterator; +import java.util.Map; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -52,16 +54,6 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { private static Logger log = LoggerFactory.getLogger(InfinispanEmbeddedCacheManager.class); - public static final String NODE_CACHE = "node-cache"; - public static final String TRIPLE_CACHE = "triple-cache"; - public static final String URI_CACHE = "uri-cache"; - public static final String BNODE_CACHE = "bnode-cache"; - public static final String LITERAL_CACHE = "literal-cache"; - public static final String NAMESPACE_URI_CACHE = "namespace-uri-cache"; - public static final String NAMESPACE_PREFIX_CACHE = "namespace-prefix-cache"; - public static final String LOADER_CACHE = "loader-cache"; - public static final String REGISTRY_CACHE = "registry-cache"; - private EmbeddedCacheManager cacheManager; // default configuration: distributed cache, 100000 entries, 300 seconds expiration, 60 seconds idle @@ -69,7 +61,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { private KiWiConfiguration config; - private Cache nodeCache, tripleCache, uriCache, literalCache, bnodeCache, nsPrefixCache, nsUriCache, registryCache; + private Map nodeCache, tripleCache, uriCache, literalCache, bnodeCache, nsPrefixCache, nsUriCache, registryCache; /** @@ -258,7 +250,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * * @return an EHCache Cache instance containing the node id -> node mappings */ - public Cache getNodeCache() { + public Map getNodeCache() { if(nodeCache == null) { Configuration nodeConfiguration = new ConfigurationBuilder().read(defaultConfiguration) .eviction() @@ -269,7 +261,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .build(); cacheManager.defineConfiguration(NODE_CACHE, nodeConfiguration); - nodeCache = cacheManager.getCache(NODE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); + nodeCache = new AsyncMap(cacheManager.getCache(NODE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP)); } return nodeCache; @@ -281,7 +273,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * * @return */ - public Cache getTripleCache() { + public Map getTripleCache() { if(tripleCache == null) { Configuration tripleConfiguration = new ConfigurationBuilder().read(defaultConfiguration) .clustering() @@ -294,7 +286,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .build(); cacheManager.defineConfiguration(TRIPLE_CACHE, tripleConfiguration); - tripleCache = cacheManager.getCache(TRIPLE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); + tripleCache = new AsyncMap(cacheManager.getCache(TRIPLE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP)); } return tripleCache; } @@ -306,7 +298,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * * @return */ - public Cache getUriCache() { + public Map getUriCache() { if(uriCache == null) { Configuration uriConfiguration = new ConfigurationBuilder().read(defaultConfiguration) .eviction() @@ -314,7 +306,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .build(); cacheManager.defineConfiguration(URI_CACHE, uriConfiguration); - uriCache = cacheManager.getCache(URI_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); + uriCache = new AsyncMap(cacheManager.getCache(URI_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP)); } return uriCache; } @@ -326,7 +318,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * * @return */ - public Cache getBNodeCache() { + public Map getBNodeCache() { if(bnodeCache == null) { Configuration bnodeConfiguration = new ConfigurationBuilder().read(defaultConfiguration) .eviction() @@ -334,7 +326,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .build(); cacheManager.defineConfiguration(BNODE_CACHE, bnodeConfiguration); - bnodeCache = cacheManager.getCache(BNODE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); + bnodeCache = new AsyncMap(cacheManager.getCache(BNODE_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP)); } return bnodeCache; } @@ -346,7 +338,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * @see org.apache.marmotta.commons.sesame.model.LiteralCommons#createCacheKey(String, java.util.Locale, String) * @return */ - public Cache getLiteralCache() { + public Map getLiteralCache() { if(literalCache == null) { Configuration literalConfiguration = new ConfigurationBuilder().read(defaultConfiguration) .eviction() @@ -354,7 +346,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .build(); cacheManager.defineConfiguration(LITERAL_CACHE, literalConfiguration); - literalCache = cacheManager.getCache(LITERAL_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); + literalCache = new AsyncMap(cacheManager.getCache(LITERAL_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP)); } return literalCache; } @@ -364,7 +356,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * Return the URI -> namespace cache from the cache manager. Used for looking up namespaces * @return */ - public Cache getNamespaceUriCache() { + public Map getNamespaceUriCache() { if(nsUriCache == null) { if(isClustered()) { Configuration nsuriConfiguration = new ConfigurationBuilder().read(defaultConfiguration) @@ -375,7 +367,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .expiration() .lifespan(1, TimeUnit.DAYS) .build(); - cacheManager.defineConfiguration(NAMESPACE_URI_CACHE, nsuriConfiguration); + cacheManager.defineConfiguration(NS_URI_CACHE, nsuriConfiguration); } else { Configuration nsuriConfiguration = new ConfigurationBuilder().read(defaultConfiguration) .eviction() @@ -383,10 +375,10 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .expiration() .lifespan(1, TimeUnit.HOURS) .build(); - cacheManager.defineConfiguration(NAMESPACE_URI_CACHE, nsuriConfiguration); + cacheManager.defineConfiguration(NS_URI_CACHE, nsuriConfiguration); } - nsUriCache = cacheManager.getCache(NAMESPACE_URI_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); + nsUriCache = new AsyncMap(cacheManager.getCache(NS_URI_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP)); } return nsUriCache; } @@ -395,7 +387,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * Return the prefix -> namespace cache from the cache manager. Used for looking up namespaces * @return */ - public Cache getNamespacePrefixCache() { + public Map getNamespacePrefixCache() { if(nsPrefixCache == null) { if(isClustered()) { Configuration nsprefixConfiguration = new ConfigurationBuilder().read(defaultConfiguration) @@ -406,7 +398,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .expiration() .lifespan(1, TimeUnit.DAYS) .build(); - cacheManager.defineConfiguration(NAMESPACE_PREFIX_CACHE, nsprefixConfiguration); + cacheManager.defineConfiguration(NS_PREFIX_CACHE, nsprefixConfiguration); } else { Configuration nsprefixConfiguration = new ConfigurationBuilder().read(defaultConfiguration) @@ -415,10 +407,10 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { .expiration() .lifespan(1, TimeUnit.HOURS) .build(); - cacheManager.defineConfiguration(NAMESPACE_PREFIX_CACHE, nsprefixConfiguration); + cacheManager.defineConfiguration(NS_PREFIX_CACHE, nsprefixConfiguration); } - nsPrefixCache = cacheManager.getCache(NAMESPACE_PREFIX_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); + nsPrefixCache = cacheManager.getCache(NS_PREFIX_CACHE).getAdvancedCache().withFlags(Flag.SKIP_LOCKING, Flag.SKIP_CACHE_LOAD, Flag.SKIP_REMOTE_LOOKUP); } return nsPrefixCache; } @@ -431,7 +423,7 @@ public class InfinispanEmbeddedCacheManager implements CacheManager { * cache and should be used with care. * @return */ - public Cache getRegistryCache() { + public Map getRegistryCache() { if(registryCache == null) { if(isClustered()) { Configuration registryConfiguration = new ConfigurationBuilder() http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/remote/InfinispanRemoteCacheManager.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/remote/InfinispanRemoteCacheManager.java b/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/remote/InfinispanRemoteCacheManager.java index a4a4e38..0090387 100644 --- a/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/remote/InfinispanRemoteCacheManager.java +++ b/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/remote/InfinispanRemoteCacheManager.java @@ -20,6 +20,9 @@ package org.apache.marmotta.kiwi.infinispan.remote; import org.apache.marmotta.kiwi.caching.CacheManager; import org.apache.marmotta.kiwi.config.KiWiConfiguration; import org.apache.marmotta.kiwi.model.rdf.*; +import org.infinispan.client.hotrod.RemoteCacheManager; +import org.infinispan.client.hotrod.configuration.Configuration; +import org.infinispan.client.hotrod.configuration.ConfigurationBuilder; import java.util.Map; @@ -32,8 +35,20 @@ public class InfinispanRemoteCacheManager implements CacheManager { private KiWiConfiguration configuration; + private RemoteCacheManager cacheManager; + + private Map nodeCache, tripleCache, uriCache, literalCache, bnodeCache, nsPrefixCache, nsUriCache, registryCache; + + public InfinispanRemoteCacheManager(KiWiConfiguration configuration) { this.configuration = configuration; + + Configuration remoteCfg = new ConfigurationBuilder() + .addServers(configuration.getClusterAddress()) + .marshaller(new CustomJBossMarshaller()) + .build(); + + cacheManager = new RemoteCacheManager(remoteCfg); } http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/util/AsyncMap.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/util/AsyncMap.java b/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/util/AsyncMap.java new file mode 100644 index 0000000..150af7d --- /dev/null +++ b/libraries/kiwi/kiwi-caching-infinispan/src/main/java/org/apache/marmotta/kiwi/infinispan/util/AsyncMap.java @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.marmotta.kiwi.infinispan.util; + +import org.infinispan.commons.api.BasicCache; + +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +/** + * A Map wrapper mapping write methods to their asynchronous equivalents in Infinispan. + * + * @author Sebastian Schaffert ([email protected]) + */ +public class AsyncMap<K,V> implements Map<K,V> { + + private BasicCache<K,V> delegate; + + public AsyncMap(BasicCache<K, V> delegate) { + this.delegate = delegate; + } + + @Override + public int size() { + return delegate.size(); + } + + @Override + public boolean isEmpty() { + return delegate.isEmpty(); + } + + @Override + public boolean containsKey(Object o) { + return delegate.containsKey(o); + } + + @Override + public boolean containsValue(Object o) { + return delegate.containsValue(o); + } + + @Override + public V get(Object o) { + return delegate.get(o); + } + + @Override + public V put(K k, V v) { + delegate.putAsync(k,v); + return null; + } + + @Override + public V remove(Object o) { + delegate.removeAsync((K)o); + return null; + } + + @Override + public void putAll(Map<? extends K, ? extends V> map) { + for(Entry<? extends K, ? extends V> entry : map.entrySet()) { + delegate.putAsync(entry.getKey(),entry.getValue()); + } + } + + @Override + public void clear() { + delegate.clear(); + } + + @Override + public Set<K> keySet() { + return delegate.keySet(); + } + + @Override + public Collection<V> values() { + return delegate.values(); + } + + @Override + public Set<Entry<K, V>> entrySet() { + return delegate.entrySet(); + } +} http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/EmbeddedClusterTest.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/EmbeddedClusterTest.java b/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/EmbeddedClusterTest.java new file mode 100644 index 0000000..17bc3cf --- /dev/null +++ b/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/EmbeddedClusterTest.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.marmotta.kiwi.test; + +import org.apache.marmotta.kiwi.config.CacheManagerType; +import org.apache.marmotta.kiwi.test.cluster.BaseClusterTest; +import org.junit.BeforeClass; + +/** + * Add file description here! + * + * @author Sebastian Schaffert ([email protected]) + */ +public class EmbeddedClusterTest extends BaseClusterTest { + + + @BeforeClass + public static void setup() { + ClusterTestSupport s = new ClusterTestSupport(CacheManagerType.INFINISPAN_CLUSTERED); + s.setup(); + } +} http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/InfinispanClusterTest.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/InfinispanClusterTest.java b/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/InfinispanClusterTest.java deleted file mode 100644 index c35a492..0000000 --- a/libraries/kiwi/kiwi-caching-infinispan/src/test/java/org/apache/marmotta/kiwi/test/InfinispanClusterTest.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.marmotta.kiwi.test; - -import org.apache.marmotta.kiwi.config.CacheManagerType; -import org.apache.marmotta.kiwi.test.cluster.BaseClusterTest; -import org.junit.BeforeClass; - -/** - * Add file description here! - * - * @author Sebastian Schaffert ([email protected]) - */ -public class InfinispanClusterTest extends BaseClusterTest { - - - @BeforeClass - public static void setup() { - ClusterTestSupport s = new ClusterTestSupport(CacheManagerType.INFINISPAN_CLUSTERED); - s.setup(); - } -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/CacheManager.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/CacheManager.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/CacheManager.java index 167b0c9..fbce98e 100644 --- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/CacheManager.java +++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/caching/CacheManager.java @@ -29,6 +29,16 @@ import java.util.Map; */ public interface CacheManager { + // cache name constants + public static final String NODE_CACHE = "node-cache"; + public static final String TRIPLE_CACHE = "triple-cache"; + public static final String URI_CACHE = "uri-cache"; + public static final String BNODE_CACHE = "bnode-cache"; + public static final String LITERAL_CACHE = "literal-cache"; + public static final String NS_URI_CACHE = "namespace-uri-cache"; + public static final String NS_PREFIX_CACHE = "namespace-prefix-cache"; + public static final String REGISTRY_CACHE = "registry-cache"; + /** * Return the node id -> node cache from the cache manager. This cache is heavily used to lookup http://git-wip-us.apache.org/repos/asf/marmotta/blob/89763d1c/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java ---------------------------------------------------------------------- diff --git a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java index fb9fb2c..2db24f2 100644 --- a/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java +++ b/libraries/kiwi/kiwi-triplestore/src/main/java/org/apache/marmotta/kiwi/config/KiWiConfiguration.java @@ -520,7 +520,7 @@ public class KiWiConfiguration { * used by JGroups to distribute and receive cache synchronization updates. Triplestores with different * data should use different ports or addresses, * <p/> - * Only used in case isClustered() is true + * Only used in case isClustered() is true and the cache mode is not client-server. * * @return */ @@ -533,7 +533,7 @@ public class KiWiConfiguration { * used by JGroups to distribute and receive cache synchronization updates. Triplestores with different * data should use different ports or addresses. * <p/> - * Only used in case isClustered() is true + * Only used in case isClustered() is true and the cache mode is not client-server. * * @return */ @@ -542,10 +542,15 @@ public class KiWiConfiguration { } /** - * Return the multicast address used by the cache cluster this triplestore belongs to. This address is - * used by JGroups to distribute and receive cache synchronization updates. Triplestores with different - * data should use different ports or addresses, - * <p/> + * The cluster address serves two purposes, depending on the kind of caching used. + * <ul> + * <li>for distributed clusters (Infinispan, Hazelcast, ...), it specifies the multicast address used by the + * cache cluster this triplestore belongs to. This address is used by JGroups to distribute and receive cache + * synchronization updates. Triplestores with different data should use different ports or addresses,</li> + * <li>for client-server caches (Infinispan Remote, Memcached, ...), it specifies the list of cache servers + * to connect to.</li> + * </ul> + * * Only used in case isClustered() is true * * @return @@ -555,9 +560,15 @@ public class KiWiConfiguration { } /** - * Change the multicast address used by the cache cluster this triplestore belongs to. This address is - * used by JGroups to distribute and receive cache synchronization updates. Triplestores with different - * data should use different ports or addresses, + * The cluster address serves two purposes, depending on the kind of caching used. + * <ul> + * <li>for distributed clusters (Infinispan, Hazelcast, ...), it specifies the multicast address used by the + * cache cluster this triplestore belongs to. This address is used by JGroups to distribute and receive cache + * synchronization updates. Triplestores with different data should use different ports or addresses,</li> + * <li>for client-server caches (Infinispan Remote, Memcached, ...), it specifies the list of cache servers + * to connect to.</li> + * </ul> + * * <p/> * Only used in case isClustered() is true *
