You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2014/02/03 13:24:52 UTC
git commit: - allow configuration of cache cluster port and address
even in platform - some library updates
Updated Branches:
refs/heads/develop 67ec953dc -> 5f99c9e31
- allow configuration of cache cluster port and address even in platform
- some library updates
Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/5f99c9e3
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/5f99c9e3
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/5f99c9e3
Branch: refs/heads/develop
Commit: 5f99c9e3181bdcb7559750077d4dbfbd54ff00e4
Parents: 67ec953
Author: Sebastian Schaffert <ss...@apache.org>
Authored: Mon Feb 3 13:24:46 2014 +0100
Committer: Sebastian Schaffert <ss...@apache.org>
Committed: Mon Feb 3 13:24:46 2014 +0100
----------------------------------------------------------------------
parent/pom.xml | 12 ++---
.../backend/kiwi/KiWiStoreProvider.java | 5 ++
.../core/services/cache/CachingServiceImpl.java | 52 +++++++++++++++-----
.../src/main/resources/jgroups-marmotta.xml | 4 +-
4 files changed, 54 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/marmotta/blob/5f99c9e3/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 6044cbe..34dd108 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -39,7 +39,7 @@
<sesame.version>2.7.10</sesame.version>
<junit.version>4.11</junit.version>
<weld.version>2.1.Final</weld.version>
- <weld.core.version>2.1.1.Final</weld.core.version>
+ <weld.core.version>2.1.2.Final</weld.core.version>
<rest.assured.version>1.7.1</rest.assured.version>
<hamcrest.version>1.3</hamcrest.version>
<tempus.fugit.version>1.1</tempus.fugit.version>
@@ -644,7 +644,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
- <version>1.6</version>
+ <version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
@@ -778,12 +778,12 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <version>1.0.13</version>
+ <version>1.1.0</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <version>1.0.13</version>
+ <version>1.1.0</version>
</dependency>
<dependency>
<groupId>ch.qos.cal10n</groupId>
@@ -1084,12 +1084,12 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
- <version>7.0.47</version>
+ <version>7.0.50</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
- <version>7.0.47</version>
+ <version>7.0.50</version>
</dependency>
<!--Secure Unique IDs -->
http://git-wip-us.apache.org/repos/asf/marmotta/blob/5f99c9e3/platform/backends/marmotta-backend-kiwi/src/main/java/org/apache/marmotta/platform/backend/kiwi/KiWiStoreProvider.java
----------------------------------------------------------------------
diff --git a/platform/backends/marmotta-backend-kiwi/src/main/java/org/apache/marmotta/platform/backend/kiwi/KiWiStoreProvider.java b/platform/backends/marmotta-backend-kiwi/src/main/java/org/apache/marmotta/platform/backend/kiwi/KiWiStoreProvider.java
index 915a1d7..29cc2b0 100644
--- a/platform/backends/marmotta-backend-kiwi/src/main/java/org/apache/marmotta/platform/backend/kiwi/KiWiStoreProvider.java
+++ b/platform/backends/marmotta-backend-kiwi/src/main/java/org/apache/marmotta/platform/backend/kiwi/KiWiStoreProvider.java
@@ -76,6 +76,8 @@ public class KiWiStoreProvider implements StoreProvider {
public static final String CACHING_QUERY_LIMIT = "caching.query.limit";
public static final String CONTEXTS_DEFAULT = "contexts.default";
public static final String CONTEXTS_INFERRED = "contexts.inferred";
+ public static final String CLUSTERING_PORT = "clustering.port";
+ public static final String CLUSTERING_ADDRESS = "clustering.address";
@Inject
private Logger log;
@@ -136,6 +138,9 @@ public class KiWiStoreProvider implements StoreProvider {
configuration.setUriCacheSize(configurationService.getIntConfiguration(CACHING_URI_SIZE, 500000));
configuration.setTripleCacheSize(configurationService.getIntConfiguration(CACHING_TRIPLE_SIZE, 100000));
+ configuration.setClusterPort(configurationService.getIntConfiguration(CLUSTERING_PORT, 46655));
+ configuration.setClusterAddress(configurationService.getStringConfiguration(CLUSTERING_ADDRESS, "228.6.7.8"));
+
NotifyingSail base = new KiWiStore(configuration, cacheManager);
/*
http://git-wip-us.apache.org/repos/asf/marmotta/blob/5f99c9e3/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java
index 67f14cc..2ac763d 100644
--- a/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java
+++ b/platform/marmotta-core/src/main/java/org/apache/marmotta/platform/core/services/cache/CachingServiceImpl.java
@@ -17,6 +17,7 @@
*/
package org.apache.marmotta.platform.core.services.cache;
+import org.apache.commons.io.IOUtils;
import org.apache.marmotta.platform.core.api.cache.CachingService;
import org.apache.marmotta.platform.core.api.config.ConfigurationService;
import org.apache.marmotta.platform.core.events.SystemRestartingEvent;
@@ -41,6 +42,7 @@ import javax.enterprise.event.Observes;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Inject;
+import java.io.IOException;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@@ -53,6 +55,10 @@ import java.util.concurrent.TimeUnit;
@ApplicationScoped
public class CachingServiceImpl implements CachingService {
+ public static final String CLUSTERING_PORT = "clustering.port";
+ public static final String CLUSTERING_ADDRESS = "clustering.address";
+ public static final String CLUSTERING_ENABLED = "clustering.enabled";
+
/**
* Get the seam logger for issuing logging statements.
*/
@@ -76,20 +82,44 @@ public class CachingServiceImpl implements CachingService {
@PostConstruct
public void initialize() {
- boolean clustered = configurationService.getBooleanConfiguration("clustering.enabled", false);
+ boolean clustered = configurationService.getBooleanConfiguration(CLUSTERING_ENABLED, false);
log.info("Apache Marmotta Caching Service starting up ({}) ...", clustered ? "cluster name: " + configurationService.getStringConfiguration("clustering.name", "Marmotta") : "single host" );
if(clustered) {
- globalConfiguration = new GlobalConfigurationBuilder()
- .transport()
- .defaultTransport()
- .clusterName(configurationService.getStringConfiguration("clustering.name", "Marmotta"))
- .machineId(configurationService.getServerName())
- .addProperty("configurationFile", "jgroups-marmotta.xml")
- .globalJmxStatistics()
- .jmxDomain("org.apache.marmotta.platform")
- .allowDuplicateDomains(true)
- .build();
+
+ try {
+ String jgroupsXml = IOUtils.toString(CachingService.class.getResourceAsStream("/jgroups-marmotta.xml"));
+
+ jgroupsXml = jgroupsXml.replaceAll("mcast_addr=\"[0-9.]+\"", String.format("mcast_addr=\"%s\"", configurationService.getStringConfiguration(CLUSTERING_ADDRESS, "228.6.7.8")));
+ jgroupsXml = jgroupsXml.replaceAll("mcast_port=\"[0-9]+\"", String.format("mcast_port=\"%d\"", configurationService.getIntConfiguration(CLUSTERING_PORT, 46655)));
+
+ globalConfiguration = new GlobalConfigurationBuilder()
+ .transport()
+ .defaultTransport()
+ .clusterName(configurationService.getStringConfiguration("clustering.name", "Marmotta"))
+ .machineId(configurationService.getServerName())
+ .addProperty("configurationXml", jgroupsXml)
+ .globalJmxStatistics()
+ .jmxDomain("org.apache.marmotta.platform")
+ .allowDuplicateDomains(true)
+ .build();
+ } catch (IOException ex) {
+ log.warn("error loading JGroups configuration from archive: {}", ex.getMessage());
+ log.warn("some configuration options will not be available");
+
+ globalConfiguration = new GlobalConfigurationBuilder()
+ .transport()
+ .defaultTransport()
+ .clusterName(configurationService.getStringConfiguration("clustering.name", "Marmotta"))
+ .machineId(configurationService.getServerName())
+ .addProperty("configurationFile", "jgroups-marmotta.xml")
+ .globalJmxStatistics()
+ .jmxDomain("org.apache.marmotta.platform")
+ .allowDuplicateDomains(true)
+ .build();
+ }
+
+
defaultConfiguration = new ConfigurationBuilder()
http://git-wip-us.apache.org/repos/asf/marmotta/blob/5f99c9e3/platform/marmotta-core/src/main/resources/jgroups-marmotta.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/main/resources/jgroups-marmotta.xml b/platform/marmotta-core/src/main/resources/jgroups-marmotta.xml
index 0c6d184..bc6accd 100644
--- a/platform/marmotta-core/src/main/resources/jgroups-marmotta.xml
+++ b/platform/marmotta-core/src/main/resources/jgroups-marmotta.xml
@@ -19,8 +19,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.4.xsd">
<UDP
- mcast_addr="${jgroups.udp.mcast_addr:228.6.7.8}"
- mcast_port="${jgroups.udp.mcast_port:46655}"
+ mcast_addr="228.6.7.8"
+ mcast_port="46655"
tos="8"
ucast_recv_buf_size="20m"
ucast_send_buf_size="640k"