joerghoh commented on code in PR #38:
URL: 
https://github.com/apache/sling-org-apache-sling-jcr-resource/pull/38#discussion_r1014635774


##########
src/main/java/org/apache/sling/jcr/resource/internal/helper/AccessMetrics.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.sling.jcr.resource.internal.helper;
+
+import java.io.Closeable;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.stream.Collectors;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *  PoJo to hold access metrics for a ResourceResolver; it is designed
+ *  for analysis of access patterns in lab situations; therefor its main
+ *  goal is to have very low overhead in case it is not used.
+ *  
+ *  this class is not threadsafe!
+ *  
+ *  This class implements autocloseable, so the statistics are written when 
the RR
+ *  is closed (see ResourceResolver.getPropertyMap)
+ *  
+ *
+ */
+public class AccessMetrics implements Closeable {
+    
+    
+    // public
+    
+    
+    public static void incrementUsage(ResourceResolver resolver, String 
operation, String path) {
+        incrementUsage(resolver,operation, path, 1);
+    }
+    
+    public static void incrementUsage(Resource resource, String operation) {
+        incrementUsage(resource.getResourceResolver(),operation, 
resource.getPath(), 1);
+    }
+    
+    public static void incrementUsage(Resource resource, String operation, 
long count) {

Review Comment:
   This method is just not used yet :-) Would like to keep it in there for the 
moment.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to