c.clear();
}
}
private static HotRodServer buildServer(int port) {
HotRodServer hotRodServer = new HotRodServer() {
@Override
public ConfigurationBuilder createTopologyCacheConfig(long distSyncTimeout) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
ConfigurationBuilder c = super.createTopologyCacheConfig(distSyncTimeout);
c.transaction().syncCommitPhase(false).syncRollbackPhase(false);
return c;
}
};
HotRodServerConfiguration hotrodConfig = new HotRodServerConfigurationBuilder()
.host("127.0.0.1")
.port(port)
.proxyHost("127.0.0.1")
.proxyPort(port)
.topologyStateTransfer(false)
.defaultCacheName(BasicCacheContainer.DEFAULT_CACHE_NAME)
.recvBufSize(4096)
.sendBufSize(4096)
//.idleTimeout(0)
.workerThreads(2)
.build(true);
GlobalConfiguration globalConfiguration = new GlobalConfigurationBuilder()
.classLoader(InfinispanEmbeddedCacheManager.class.getClassLoader())
.globalJmxStatistics()
.jmxDomain("org.apache.marmotta.kiwi")
.allowDuplicateDomains(true)
.build();
Configuration defaultConfiguration = new ConfigurationBuilder()
.clustering()
.cacheMode(CacheMode.LOCAL)
.sync()
.dataContainer()
.keyEquivalence(ByteArrayEquivalence.INSTANCE)
.valueEquivalence(ByteArrayEquivalence.INSTANCE)
.build();
EmbeddedCacheManager cacheManager = new DefaultCacheManager(globalConfiguration, defaultConfiguration, true);
cacheManager.defineConfiguration(CacheManager.NODE_CACHE, defaultConfiguration);
cacheManager.defineConfiguration(CacheManager.TRIPLE_CACHE, defaultConfiguration);
cacheManager.defineConfiguration(CacheManager.URI_CACHE, defaultConfiguration);
cacheManager.defineConfiguration(CacheManager.BNODE_CACHE, defaultConfiguration);
cacheManager.defineConfiguration(CacheManager.LITERAL_CACHE, defaultConfiguration);
cacheManager.defineConfiguration(CacheManager.NS_PREFIX_CACHE, defaultConfiguration);
cacheManager.defineConfiguration(CacheManager.NS_URI_CACHE, defaultConfiguration);
cacheManager.defineConfiguration(CacheManager.REGISTRY_CACHE, defaultConfiguration);
cacheManager.getCache(CacheManager.NODE_CACHE, true);
cacheManager.getCache(CacheManager.TRIPLE_CACHE, true);
cacheManager.getCache(CacheManager.URI_CACHE, true);
cacheManager.getCache(CacheManager.BNODE_CACHE, true);
cacheManager.getCache(CacheManager.LITERAL_CACHE, true);
cacheManager.getCache(CacheManager.NS_PREFIX_CACHE, true);
cacheManager.getCache(CacheManager.NS_URI_CACHE, true);
cacheManager.getCache(CacheManager.REGISTRY_CACHE, true);
hotRodServer.start(hotrodConfig, cacheManager);
return hotRodServer;
}