Author: andy
Date: Fri Jul 5 13:29:37 2013
New Revision: 1500001
URL: http://svn.apache.org/r1500001
Log:
Move counter setup to DatasetRef.init().
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java?rev=1500001&r1=1500000&r2=1500001&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/DatasetRef.java
Fri Jul 5 13:29:37 2013
@@ -61,6 +61,7 @@ public class DatasetRef implements Datas
add(upload) ;
add(readGraphStore) ;
add(readWriteGraphStore) ;
+ addCounters() ;
}
private void add(ServiceRef srvRef) {
@@ -170,4 +171,67 @@ public class DatasetRef implements Datas
public long getRequestsBad() {
return counters.value(CounterName.RequestsBad) ;
}
+
+ private void addCounters() {
+ counters.add(CounterName.Requests) ;
+ counters.add(CounterName.RequestsGood) ;
+ counters.add(CounterName.RequestsBad) ;
+
+ query.counters.add(CounterName.Requests) ;
+ query.counters.add(CounterName.RequestsGood) ;
+ query.counters.add(CounterName.RequestsBad) ;
+ query.counters.add(CounterName.QueryTimeouts) ;
+ query.counters.add(CounterName.QueryExecErrors) ;
+
+ update.counters.add(CounterName.Requests) ;
+ update.counters.add(CounterName.RequestsGood) ;
+ update.counters.add(CounterName.RequestsBad) ;
+ update.counters.add(CounterName.UpdateExecErrors) ;
+
+ upload.counters.add(CounterName.Requests) ;
+ upload.counters.add(CounterName.RequestsGood) ;
+ upload.counters.add(CounterName.RequestsBad) ;
+
+ addCountersForGSP(readWriteGraphStore.counters, false) ;
+ if ( readGraphStore != readWriteGraphStore )
+ addCountersForGSP(readGraphStore.counters, true) ;
+ }
+
+ private void addCountersForGSP(CounterSet cs, boolean readWrite) {
+ cs.add(CounterName.Requests) ;
+ cs.add(CounterName.RequestsGood) ;
+ cs.add(CounterName.RequestsBad) ;
+
+ cs.add(CounterName.GSPget) ;
+ cs.add(CounterName.GSPgetGood) ;
+ cs.add(CounterName.GSPgetBad) ;
+
+ cs.add(CounterName.GSPhead) ;
+ cs.add(CounterName.GSPheadGood) ;
+ cs.add(CounterName.GSPheadBad) ;
+
+ // Add anyway.
+ // if ( ! readWrite )
+ // return ;
+
+ cs.add(CounterName.GSPput) ;
+ cs.add(CounterName.GSPputGood) ;
+ cs.add(CounterName.GSPputBad) ;
+
+ cs.add(CounterName.GSPpost) ;
+ cs.add(CounterName.GSPpostGood) ;
+ cs.add(CounterName.GSPpostBad) ;
+
+ cs.add(CounterName.GSPdelete) ;
+ cs.add(CounterName.GSPdeleteGood) ;
+ cs.add(CounterName.GSPdeleteBad) ;
+
+ cs.add(CounterName.GSPpatch) ;
+ cs.add(CounterName.GSPpatchGood) ;
+ cs.add(CounterName.GSPpatchBad) ;
+
+ cs.add(CounterName.GSPoptions) ;
+ cs.add(CounterName.GSPoptionsGood) ;
+ cs.add(CounterName.GSPoptionsBad) ;
+ }
}
Modified:
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java?rev=1500001&r1=1500000&r2=1500001&view=diff
==============================================================================
---
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
(original)
+++
jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/server/SPARQLServer.java
Fri Jul 5 13:29:37 2013
@@ -295,7 +295,6 @@ public class SPARQLServer {
if ( datasetPath.endsWith("/") )
datasetPath = datasetPath.substring(0, datasetPath.length() - 1) ;
- addCounters(dsDesc) ;
dsDesc.init() ;
DatasetRegistry.get().put(datasetPath, dsDesc) ;
@@ -438,69 +437,6 @@ public class SPARQLServer {
context.addFilter(GzipFilter.class, pathSpec,
EnumSet.allOf(DispatcherType.class)) ;
}
- private static void addCounters(DatasetRef sDesc) {
- sDesc.counters.add(CounterName.Requests) ;
- sDesc.counters.add(CounterName.RequestsGood) ;
- sDesc.counters.add(CounterName.RequestsBad) ;
-
- sDesc.query.counters.add(CounterName.Requests) ;
- sDesc.query.counters.add(CounterName.RequestsGood) ;
- sDesc.query.counters.add(CounterName.RequestsBad) ;
- sDesc.query.counters.add(CounterName.QueryTimeouts) ;
- sDesc.query.counters.add(CounterName.QueryExecErrors) ;
-
- sDesc.update.counters.add(CounterName.Requests) ;
- sDesc.update.counters.add(CounterName.RequestsGood) ;
- sDesc.update.counters.add(CounterName.RequestsBad) ;
- sDesc.update.counters.add(CounterName.UpdateExecErrors) ;
-
- sDesc.upload.counters.add(CounterName.Requests) ;
- sDesc.upload.counters.add(CounterName.RequestsGood) ;
- sDesc.upload.counters.add(CounterName.RequestsBad) ;
-
- addCountersForGSP(sDesc.readWriteGraphStore.counters, false) ;
- if ( sDesc.readGraphStore != sDesc.readGraphStore )
- addCountersForGSP(sDesc.readGraphStore.counters, true) ;
- }
-
- private static void addCountersForGSP(CounterSet cs, boolean readWrite) {
- cs.add(CounterName.Requests) ;
- cs.add(CounterName.RequestsGood) ;
- cs.add(CounterName.RequestsBad) ;
-
- cs.add(CounterName.GSPget) ;
- cs.add(CounterName.GSPgetGood) ;
- cs.add(CounterName.GSPgetBad) ;
-
- cs.add(CounterName.GSPhead) ;
- cs.add(CounterName.GSPheadGood) ;
- cs.add(CounterName.GSPheadBad) ;
-
- // Add anyway.
- // if ( ! readWrite )
- // return ;
-
- cs.add(CounterName.GSPput) ;
- cs.add(CounterName.GSPputGood) ;
- cs.add(CounterName.GSPputBad) ;
-
- cs.add(CounterName.GSPpost) ;
- cs.add(CounterName.GSPpostGood) ;
- cs.add(CounterName.GSPpostBad) ;
-
- cs.add(CounterName.GSPdelete) ;
- cs.add(CounterName.GSPdeleteGood) ;
- cs.add(CounterName.GSPdeleteBad) ;
-
- cs.add(CounterName.GSPpatch) ;
- cs.add(CounterName.GSPpatchGood) ;
- cs.add(CounterName.GSPpatchBad) ;
-
- cs.add(CounterName.GSPoptions) ;
- cs.add(CounterName.GSPoptionsGood) ;
- cs.add(CounterName.GSPoptionsBad) ;
- }
-
private void addJMX() {
DatasetRegistry registry = DatasetRegistry.get() ;
for (String ds : registry.keys()) {