diff --git a/gradle.properties b/gradle.properties index 89d98f0..11b00d8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group = org.xbib name = metrics -version = 2.1.0 +version = 2.2.0 -gradle.wrapper.version = 6.4.1 +gradle.wrapper.version = 6.6.1 diff --git a/gradle/compile/java.gradle b/gradle/compile/java.gradle index a9d76ce..7fe543e 100644 --- a/gradle/compile/java.gradle +++ b/gradle/compile/java.gradle @@ -28,6 +28,7 @@ task sourcesJar(type: Jar, dependsOn: classes) { task javadocJar(type: Jar, dependsOn: javadoc) { classifier 'javadoc' + from javadoc.destinationDir } artifacts { diff --git a/gradle/publishing/publication.gradle b/gradle/publishing/publication.gradle index c35fcb9..53b1beb 100644 --- a/gradle/publishing/publication.gradle +++ b/gradle/publishing/publication.gradle @@ -53,12 +53,14 @@ if (project.hasProperty("signing.keyId")) { } } -nexusPublishing { - repositories { - sonatype { - username = project.property('ossrhUsername') - password = project.property('ossrhPassword') - packageGroup = "org.xbib" +if (project.hasProperty("ossrhUsername")) { + nexusPublishing { + repositories { + sonatype { + username = project.property('ossrhUsername') + password = project.property('ossrhPassword') + packageGroup = "org.xbib" + } } } -} +} \ No newline at end of file diff --git a/gradle/repositories/maven.gradle b/gradle/repositories/maven.gradle new file mode 100644 index 0000000..ec58acb --- /dev/null +++ b/gradle/repositories/maven.gradle @@ -0,0 +1,4 @@ +repositories { + mavenLocal() + mavenCentral() +} diff --git a/gradle/test/junit5.gradle b/gradle/test/junit5.gradle index cfef972..4191db1 100644 --- a/gradle/test/junit5.gradle +++ b/gradle/test/junit5.gradle @@ -1,5 +1,5 @@ -def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.6.2' +def junitVersion = project.hasProperty('junit.version')?project.property('junit.version'):'5.7.2' def hamcrestVersion = project.hasProperty('hamcrest.version')?project.property('hamcrest.version'):'2.2' dependencies { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c05..e708b1c 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 21e622d..33682bb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c51..4f906e0 100755 --- a/gradlew +++ b/gradlew @@ -130,7 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index a9f778a..ac1b06f 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,21 +64,6 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line @@ -86,7 +71,7 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/metrics-api/src/main/java/org/xbib/metrics/api/Count.java b/metrics-api/src/main/java/org/xbib/metrics/api/Count.java index 4e0673f..67157fb 100644 --- a/metrics-api/src/main/java/org/xbib/metrics/api/Count.java +++ b/metrics-api/src/main/java/org/xbib/metrics/api/Count.java @@ -9,22 +9,14 @@ public interface Count { void inc(long n); - void inc(String index, String type, String id); - void dec(); void dec(long n); - void dec(String index, String type, String id); - /** * Returns the current count. * * @return the current count */ long getCount(); - - String getIncChecksum(String index, String type); - - String getDecChecksum(String index, String type); } diff --git a/metrics-common/src/main/java/org/xbib/metrics/common/CountMetric.java b/metrics-common/src/main/java/org/xbib/metrics/common/CountMetric.java index bf40573..182a1d0 100644 --- a/metrics-common/src/main/java/org/xbib/metrics/common/CountMetric.java +++ b/metrics-common/src/main/java/org/xbib/metrics/common/CountMetric.java @@ -3,11 +3,7 @@ package org.xbib.metrics.common; import org.xbib.metrics.api.Count; import org.xbib.metrics.api.Metric; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; import java.util.concurrent.atomic.LongAdder; -import java.util.zip.CRC32; /** * An incrementing and decrementing counter metric. @@ -16,14 +12,8 @@ public class CountMetric implements Metric, Count { private final LongAdder count; - private final Map checksumIn; - - private final Map checksumOut; - public CountMetric() { this.count = new LongAdder(); - this.checksumIn = new HashMap<>(); - this.checksumOut = new HashMap<>(); } /** @@ -44,19 +34,6 @@ public class CountMetric implements Metric, Count { count.add(n); } - @Override - public void inc(String index, String type, String id) { - CRC32 crc32 = checksumIn.get(index + "/" + type); - if (crc32 == null) { - crc32 = new CRC32(); - checksumIn.put(index + "/" + type, crc32); - } - if (id != null) { - byte[] b = id.getBytes(StandardCharsets.UTF_8); - crc32.update(b, 0, b.length); - } - } - /** * Decrement the counter by one. */ @@ -75,19 +52,6 @@ public class CountMetric implements Metric, Count { count.add(-n); } - @Override - public void dec(String index, String type, String id) { - CRC32 crc32 = checksumOut.get(index + "/" + type); - if (crc32 == null) { - crc32 = new CRC32(); - checksumOut.put(index + "/" + type, crc32); - } - if (id != null) { - byte[] b = id.getBytes(StandardCharsets.UTF_8); - crc32.update(b, 0, b.length); - } - } - /** * Returns the counter's current value. * @@ -98,15 +62,4 @@ public class CountMetric implements Metric, Count { return count.sum(); } - @Override - public String getIncChecksum(String index, String type) { - return Long.toHexString(checksumIn.containsKey(index + "/" + type) ? - checksumIn.get(index + "/" + type).getValue() : 0L); - } - - @Override - public String getDecChecksum(String index, String type) { - return Long.toHexString(checksumOut.containsKey(index + "/" + type) ? - checksumOut.get(index + "/" + type).getValue() : 0L); - } } diff --git a/metrics-common/src/main/java/org/xbib/metrics/common/Histogram.java b/metrics-common/src/main/java/org/xbib/metrics/common/Histogram.java index 1682f1e..f2fc336 100644 --- a/metrics-common/src/main/java/org/xbib/metrics/common/Histogram.java +++ b/metrics-common/src/main/java/org/xbib/metrics/common/Histogram.java @@ -46,11 +46,6 @@ public class Histogram implements Metric, Sampling, Count { reservoir.update(value); } - @Override - public void inc(String index, String type, String id) { - // not used - } - @Override public void dec() { dec(1); @@ -61,11 +56,6 @@ public class Histogram implements Metric, Sampling, Count { throw new UnsupportedOperationException(); } - @Override - public void dec(String index, String type, String id) { - // not used - } - /** * Returns the number of values recorded. * @@ -76,16 +66,6 @@ public class Histogram implements Metric, Sampling, Count { return count.sum(); } - @Override - public String getIncChecksum(String index, String type) { - return null; - } - - @Override - public String getDecChecksum(String index, String type) { - return null; - } - @Override public Snapshot getSnapshot() { return reservoir.getSnapshot(); diff --git a/metrics-common/src/main/java/org/xbib/metrics/common/MetricRegistry.java b/metrics-common/src/main/java/org/xbib/metrics/common/MetricRegistry.java index 8b9a8b9..9d5deca 100644 --- a/metrics-common/src/main/java/org/xbib/metrics/common/MetricRegistry.java +++ b/metrics-common/src/main/java/org/xbib/metrics/common/MetricRegistry.java @@ -22,7 +22,7 @@ import java.util.concurrent.Executors; */ public class MetricRegistry implements MetricSet { - private final ConcurrentMap metrics; + private final Map metrics; private final List listeners;