From 9a0dcd0fae1b885717c3edb316f348600c2bcc4e Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 15:50:09 +0100 Subject: [PATCH 01/11] Update antlr to 4.9.3 and fix grammar issue --- .../main/antlr4/org/wso2/siddhi/query/compiler/SiddhiQL.g4 | 4 ++-- pom.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/siddhi-query-compiler/src/main/antlr4/org/wso2/siddhi/query/compiler/SiddhiQL.g4 b/modules/siddhi-query-compiler/src/main/antlr4/org/wso2/siddhi/query/compiler/SiddhiQL.g4 index 7b2729ffe8..eb225457ba 100644 --- a/modules/siddhi-query-compiler/src/main/antlr4/org/wso2/siddhi/query/compiler/SiddhiQL.g4 +++ b/modules/siddhi-query-compiler/src/main/antlr4/org/wso2/siddhi/query/compiler/SiddhiQL.g4 @@ -853,8 +853,8 @@ ID : [a-zA-Z_] [a-zA-Z_0-9]* ; STRING_LITERAL :( - '\'' ( ~('\u0000'..'\u001f' | '\''| '\"' ) )* '\'' - |'"' ( ~('\u0000'..'\u001f' |'\"') )* '"' + '\'' ( ~('\u0000'..'\u001f' | '\''| '"' ) )* '\'' + |'"' ( ~('\u0000'..'\u001f' |'"') )* '"' ) {setText(getText().substring(1, getText().length()-1));} |('"""'(.*?)'"""') {setText(getText().substring(3, getText().length()-3));} ; diff --git a/pom.xml b/pom.xml index c8bff8ea20..f5a29da3fe 100644 --- a/pom.xml +++ b/pom.xml @@ -342,7 +342,7 @@ org.antlr antlr4-maven-plugin - 4.2.2 + ${antlr.runtime.version} org.apache.maven.plugins @@ -483,7 +483,7 @@ [1.2.17, 1.3.0) 1.7.12 2.2.1.Final - 4.5.1 + 4.9.3 3.3.2.wso2v2 19.0 2.8.0 From 5032e4561180807d630d96aa6fb38007aedd0a89 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 15:50:39 +0100 Subject: [PATCH 02/11] Update GHA workflow --- .github/workflows/maven.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 6a0a802587..fc4e02e312 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -17,7 +17,7 @@ jobs: - "8" steps: - - uses: "actions/checkout@v3" + - uses: "actions/checkout@v4" - name: "Set up JDK ${{ matrix.version }}" uses: "actions/setup-java@v3" @@ -28,5 +28,8 @@ jobs: - name: "Build" shell: "bash" + env: + MAVEN_ARGS: "--show-version --batch-mode --fail-fast --no-transfer-progress" + MAVEN_OPTS: "-Dstyle.color=always -DtrimStackTrace=false" run: | - mvn --show-version --batch-mode --fail-fast clean package + mvn clean package From a0ebe51655f381d4c037374c6ca5fbbe5f34b0ef Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 15:55:14 +0100 Subject: [PATCH 03/11] Remove ObjectSizeCalculator class to fix build with Java 17 The ObjectSizeCalculator class is using reflective access which doesn't work with Java 17 anymore. Adjust the SiddhiMemoryUsageMetric class to always return 0 for object size. --- .../memory/ObjectSizeCalculator.java | 447 ------------------ .../metrics/SiddhiMemoryUsageMetric.java | 7 +- 2 files changed, 1 insertion(+), 453 deletions(-) delete mode 100644 modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/memory/ObjectSizeCalculator.java diff --git a/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/memory/ObjectSizeCalculator.java b/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/memory/ObjectSizeCalculator.java deleted file mode 100644 index 8b909fca9f..0000000000 --- a/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/memory/ObjectSizeCalculator.java +++ /dev/null @@ -1,447 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. 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.wso2.siddhi.core.util.statistics.memory; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.Sets; -import org.apache.log4j.Logger; -import org.wso2.siddhi.core.config.SiddhiAppContext; -import org.wso2.siddhi.core.query.output.callback.OutputCallback; -import org.wso2.siddhi.core.stream.StreamJunction; -import org.wso2.siddhi.core.stream.output.StreamCallback; -import org.wso2.siddhi.core.table.record.AbstractRecordTable; -import org.wso2.siddhi.core.util.statistics.BufferedEventsTracker; -import org.wso2.siddhi.core.util.statistics.LatencyTracker; -import org.wso2.siddhi.core.util.statistics.MemoryCalculable; -import org.wso2.siddhi.core.util.statistics.MemoryUsageTracker; -import org.wso2.siddhi.core.util.statistics.StatisticsManager; -import org.wso2.siddhi.core.util.statistics.ThroughputTracker; - -import java.lang.management.ManagementFactory; -import java.lang.management.MemoryPoolMXBean; -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayDeque; -import java.util.Arrays; -import java.util.Deque; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -/** - * Contains utility methods for calculating the memory usage of objects. It - * only works on the HotSpot JVM, and infers the actual memory layout (32 bit - * vs. 64 bit word size, compressed object pointers vs. uncompressed) from - * best available indicators. It can reliably detect a 32 bit vs. 64 bit JVM. - * It can only make an educated guess at whether compressed OOPs are used, - * though; specifically, it knows what the JVM's default choice of OOP - * compression would be based on HotSpot version and maximum heap sizes, but if - * the choice is explicitly overridden with the -XX:{+|-}UseCompressedOops - * command line switch, it can not detect this fact and will report incorrect sizes, - * as it will presume the default JVM behavior. - * - * @author Attila Szegedi - */ -public class ObjectSizeCalculator { - private static final Logger log = Logger.getLogger(ObjectSizeCalculator.class); - - // Fixed object header size for arrays. - private final int arrayHeaderSize; - // Fixed object header size for non-array objects. - private final int objectHeaderSize; - // Padding for the object size - if the object size is not an exact multiple of this, - // it's padded to the next multiple. - private final int objectPadding; - // Size of reference (pointer) fields. - private final int referenceSize; - // Padding for the fields of superclass before fields of subclasses are added. - private final int superclassFieldPadding; - private final LoadingCache, ClassSizeInfo> classSizeInfos = - CacheBuilder.newBuilder().build(new CacheLoader, ClassSizeInfo>() { - public ClassSizeInfo load(Class clazz) { - return new ClassSizeInfo(clazz); - } - }); - private final Set ignoreCalculation = Sets.newIdentityHashSet(); - private final Set alreadyVisited = Sets.newIdentityHashSet(); - private final Deque pending = new ArrayDeque(16 * 1024); - private long size; - - - /** - * Creates an object size calculator that can calculate object sizes for a given - * {@code memoryLayoutSpecification}. - * - * @param memoryLayoutSpecification a description of the JVM memory layout. - */ - public ObjectSizeCalculator(MemoryLayoutSpecification memoryLayoutSpecification) { - Preconditions.checkNotNull(memoryLayoutSpecification); - arrayHeaderSize = memoryLayoutSpecification.getArrayHeaderSize(); - objectHeaderSize = memoryLayoutSpecification.getObjectHeaderSize(); - objectPadding = memoryLayoutSpecification.getObjectPadding(); - referenceSize = memoryLayoutSpecification.getReferenceSize(); - superclassFieldPadding = memoryLayoutSpecification.getSuperclassFieldPadding(); - ignoreCalculation.add(SiddhiAppContext.class); - ignoreCalculation.add(StreamJunction.class); - ignoreCalculation.add(OutputCallback.class); - ignoreCalculation.add(StreamCallback.class); - ignoreCalculation.add(ThroughputTracker.class); - ignoreCalculation.add(LatencyTracker.class); - ignoreCalculation.add(MemoryUsageTracker.class); - ignoreCalculation.add(BufferedEventsTracker.class); - ignoreCalculation.add(StatisticsManager.class); - ignoreCalculation.add(MemoryCalculable.class); - ignoreCalculation.add(AbstractRecordTable.class); - } - - /** - * Given an object, returns the total allocated size, in bytes, of the object - * and all other objects reachable from it. Attempts to to detect the current JVM memory layout, - * but may fail with {@link UnsupportedOperationException}; - * - * @param obj the object; can be null. Passing in a {@link java.lang.Class} object doesn't do - * anything special, it measures the size of all objects - * reachable through it (which will include its class loader, and by - * extension, all other Class objects loaded by - * the same loader, and all the parent class loaders). It doesn't provide the - * size of the static fields in the JVM class that the Class object - * represents. - * @return the total allocated size of the object and all other objects it - * retains. - * @throws UnsupportedOperationException if the current vm memory layout cannot be detected. - */ - public static long getObjectSize(Object obj) throws UnsupportedOperationException { - return obj == null ? 0 : new ObjectSizeCalculator(CurrentLayout.SPEC).calculateObjectSize(obj); - } - - @VisibleForTesting - static long roundTo(long x, int multiple) { - return ((x + multiple - 1) / multiple) * multiple; - } - - private static long getPrimitiveFieldSize(Class type) { - if (type == boolean.class || type == byte.class) { - return 1; - } - if (type == char.class || type == short.class) { - return 2; - } - if (type == int.class || type == float.class) { - return 4; - } - if (type == long.class || type == double.class) { - return 8; - } - throw new AssertionError("Encountered unexpected primitive type " + type.getName()); - } - - @VisibleForTesting - static MemoryLayoutSpecification getEffectiveMemoryLayoutSpecification() { - final String vmName = System.getProperty("java.vm.name"); - if (vmName == null - || !(vmName.startsWith("Java HotSpot(TM) ") - || vmName.startsWith("OpenJDK") - || vmName.startsWith("TwitterJDK"))) { - throw new UnsupportedOperationException("ObjectSizeCalculator only supported on HotSpot VM"); - } - - final String dataModel = System.getProperty("sun.arch.data.model"); - if ("32".equals(dataModel)) { - // Running with 32-bit data model. - return new MemoryLayoutSpecification() { - @Override - public int getArrayHeaderSize() { - return 12; - } - - @Override - public int getObjectHeaderSize() { - return 8; - } - - @Override - public int getObjectPadding() { - return 8; - } - - @Override - public int getReferenceSize() { - return 4; - } - - @Override - public int getSuperclassFieldPadding() { - return 4; - } - }; - } else if (!"64".equals(dataModel)) { - throw new UnsupportedOperationException("Unrecognized value '" + - dataModel + "' of sun.arch.data.model system property"); - } - - final String strVmVersion = System.getProperty("java.vm.version"); - final int vmVersion = Integer.parseInt(strVmVersion.substring(0, strVmVersion.indexOf('.'))); - if (vmVersion >= 17) { - long maxMemory = 0; - for (MemoryPoolMXBean mp : ManagementFactory.getMemoryPoolMXBeans()) { - maxMemory += mp.getUsage().getMax(); - } - if (maxMemory < 30L * 1024 * 1024 * 1024) { - // HotSpot 17.0 and above use compressed OOPs below 30GB of RAM total - // for all memory pools (yes, including code cache). - return new MemoryLayoutSpecification() { - @Override - public int getArrayHeaderSize() { - return 16; - } - - @Override - public int getObjectHeaderSize() { - return 12; - } - - @Override - public int getObjectPadding() { - return 8; - } - - @Override - public int getReferenceSize() { - return 4; - } - - @Override - public int getSuperclassFieldPadding() { - return 4; - } - }; - } - } - - // In other cases, it's a 64-bit uncompressed OOPs object model - return new MemoryLayoutSpecification() { - @Override - public int getArrayHeaderSize() { - return 24; - } - - @Override - public int getObjectHeaderSize() { - return 16; - } - - @Override - public int getObjectPadding() { - return 8; - } - - @Override - public int getReferenceSize() { - return 8; - } - - @Override - public int getSuperclassFieldPadding() { - return 8; - } - }; - } - - /** - * Given an object, returns the total allocated size, in bytes, of the object - * and all other objects reachable from it. - * - * @param obj the object; can be null. Passing in a {@link java.lang.Class} object doesn't do - * anything special, it measures the size of all objects - * reachable through it (which will include its class loader, and by - * extension, all other Class objects loaded by - * the same loader, and all the parent class loaders). It doesn't provide the - * size of the static fields in the JVM class that the Class object - * represents. - * @return the total allocated size of the object and all other objects it - * retains. - */ - public synchronized long calculateObjectSize(Object obj) { - boolean isFirst = true; - if (log.isDebugEnabled()) { - log.debug("Object for size calculation: " + obj.getClass().getName()); - } - // Breadth-first traversal instead of naive depth-first with recursive - // implementation, so we don't blow the stack traversing long linked lists. - try { - for (;; ) { - visit(obj, isFirst); - isFirst = false; - if (pending.isEmpty()) { - return size; - } - obj = pending.removeFirst(); - } - } finally { - alreadyVisited.clear(); - pending.clear(); - size = 0; - } - } - - private void visit(Object obj, boolean isFirst) { - if (alreadyVisited.contains(obj)) { - return; - } - final Class clazz = obj.getClass(); - if (!isFirst) { - for (Class ignoreClazz : ignoreCalculation) { - if (ignoreClazz.isAssignableFrom(obj.getClass())) { - return; - } - } - } - if (clazz == ArrayElementsVisitor.class) { - ((ArrayElementsVisitor) obj).visit(this); - } else { - alreadyVisited.add(obj); - if (clazz.isArray()) { - visitArray(obj); - } else { - if (log.isDebugEnabled()) { - log.debug("Class used for size calculation: " + clazz); - } - classSizeInfos.getUnchecked(clazz).visit(obj, this); - } - } - } - - private void visitArray(Object array) { - final Class componentType = array.getClass().getComponentType(); - final int length = Array.getLength(array); - if (componentType.isPrimitive()) { - increaseByArraySize(length, getPrimitiveFieldSize(componentType)); - } else { - increaseByArraySize(length, referenceSize); - // If we didn't use an ArrayElementsVisitor, we would be enqueueing every - // element of the array here instead. For large arrays, it would - // tremendously enlarge the queue. In essence, we're compressing it into - // a small command object instead. This is different than immediately - // visiting the elements, as their visiting is scheduled for the end of - // the current queue. - switch (length) { - case 0: { - break; - } - case 1: { - enqueue(Array.get(array, 0)); - break; - } - default: { - enqueue(new ArrayElementsVisitor((Object[]) array)); - } - } - } - } - - private void increaseByArraySize(int length, long elementSize) { - increaseSize(roundTo(arrayHeaderSize + length * elementSize, objectPadding)); - } - - void enqueue(Object obj) { - if (obj != null) { - pending.addLast(obj); - } - } - - void increaseSize(long objectSize) { - size += objectSize; - } - - - private static class CurrentLayout { - private static final MemoryLayoutSpecification SPEC = getEffectiveMemoryLayoutSpecification(); - } - - private static class ArrayElementsVisitor { - private final Object[] array; - - ArrayElementsVisitor(Object[] array) { - this.array = array; - } - - public void visit(ObjectSizeCalculator calc) { - for (Object elem : array) { - if (elem != null) { - calc.visit(elem, false); - } - } - } - } - - private class ClassSizeInfo { - private final long objectSize; // Padded fields + header size - private final long fieldsSize; // Only the fields size - used to calculate the subclasses' memory footprint. - private final Field[] referenceFields; - - public ClassSizeInfo(Class clazz) { - long fieldsSize = 0; - final List referenceFields = new LinkedList(); - for (Field f : clazz.getDeclaredFields()) { - if (Modifier.isStatic(f.getModifiers())) { - continue; - } - final Class type = f.getType(); - if (type.isPrimitive()) { - fieldsSize += getPrimitiveFieldSize(type); - } else { - f.setAccessible(true); - referenceFields.add(f); - fieldsSize += referenceSize; - } - } - final Class superClass = clazz.getSuperclass(); - if (superClass != null) { - final ClassSizeInfo superClassInfo = classSizeInfos.getUnchecked(superClass); - fieldsSize += roundTo(superClassInfo.fieldsSize, superclassFieldPadding); - referenceFields.addAll(Arrays.asList(superClassInfo.referenceFields)); - } - this.fieldsSize = fieldsSize; - this.objectSize = roundTo(objectHeaderSize + fieldsSize, objectPadding); - this.referenceFields = referenceFields.toArray(new Field[referenceFields.size()]); - } - - void visit(Object obj, ObjectSizeCalculator calc) { - calc.increaseSize(objectSize); - enqueueReferencedObjects(obj, calc); - } - - public void enqueueReferencedObjects(Object obj, ObjectSizeCalculator calc) { - for (Field f : referenceFields) { - try { - calc.enqueue(f.get(obj)); - } catch (IllegalAccessException e) { - final AssertionError ae = new AssertionError("Unexpected denial of access to " + f); - ae.initCause(e); - throw ae; - } - } - } - } -} diff --git a/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiMemoryUsageMetric.java b/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiMemoryUsageMetric.java index 6bc86d5b5b..793b8b85e3 100644 --- a/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiMemoryUsageMetric.java +++ b/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiMemoryUsageMetric.java @@ -21,7 +21,6 @@ import com.codahale.metrics.Gauge; import com.codahale.metrics.MetricRegistry; import org.wso2.siddhi.core.util.statistics.MemoryUsageTracker; -import org.wso2.siddhi.core.util.statistics.memory.ObjectSizeCalculator; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -94,11 +93,7 @@ public ObjectMetric(final Object object, String name) { this.gauge = new Gauge() { @Override public Long getValue() { - try { - return ObjectSizeCalculator.getObjectSize(object); - } catch (UnsupportedOperationException e) { - return 0L; - } + return 0L; } }; } From 55b9f235be1ad94f4f5b4ed2962bec0d363a4787 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 16:32:21 +0100 Subject: [PATCH 04/11] Bump antlr to 4.13.1 Also bump jacoco to fix build with Java 17. --- .github/workflows/maven.yml | 1 + pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index fc4e02e312..0d2c32b7cf 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,6 +15,7 @@ jobs: matrix: java-version: - "8" + - "17" steps: - uses: "actions/checkout@v4" diff --git a/pom.xml b/pom.xml index f5a29da3fe..c24a6a9cf5 100644 --- a/pom.xml +++ b/pom.xml @@ -483,7 +483,7 @@ [1.2.17, 1.3.0) 1.7.12 2.2.1.Final - 4.9.3 + 4.13.1 3.3.2.wso2v2 19.0 2.8.0 @@ -505,7 +505,7 @@ 2.3.25-incubating 1.3.2 1.21 - 0.7.9 + 0.8.11 3.0.4 findbugs-exclude.xml checkstyle-suppressions.xml From 43c4ddb77a8b71701d1c20627817ff1decdc9764 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 16:58:27 +0100 Subject: [PATCH 05/11] Clean up unused dependencies in modules --- modules/siddhi-core/pom.xml | 19 ++++++++++--------- modules/siddhi-query-api/pom.xml | 4 ---- modules/siddhi-query-compiler/pom.xml | 9 --------- pom.xml | 7 +++++++ 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/modules/siddhi-core/pom.xml b/modules/siddhi-core/pom.xml index 9bb88bf427..933c7b1e05 100644 --- a/modules/siddhi-core/pom.xml +++ b/modules/siddhi-core/pom.xml @@ -47,10 +47,6 @@ org.apache.log4j.wso2 log4j - - org.slf4j - slf4j-simple - org.wso2.orbit.com.lmax disruptor @@ -60,6 +56,11 @@ testng test + + junit + junit + test + com.google.guava guava @@ -72,10 +73,6 @@ com.google.code.gson gson - - com.jayway.jsonpath - json-path - org.eclipse.osgi org.eclipse.osgi.services @@ -84,6 +81,10 @@ org.osgi org.osgi.core + + org.atteo.classindex + classindex + @@ -132,4 +133,4 @@ ../../findbugs-exclude.xml - \ No newline at end of file + diff --git a/modules/siddhi-query-api/pom.xml b/modules/siddhi-query-api/pom.xml index d1fd5f0253..359c8d0d1d 100644 --- a/modules/siddhi-query-api/pom.xml +++ b/modules/siddhi-query-api/pom.xml @@ -29,10 +29,6 @@ bundle - - org.apache.log4j.wso2 - log4j - org.testng testng diff --git a/modules/siddhi-query-compiler/pom.xml b/modules/siddhi-query-compiler/pom.xml index fc3aa62690..7089c79e6b 100644 --- a/modules/siddhi-query-compiler/pom.xml +++ b/modules/siddhi-query-compiler/pom.xml @@ -34,15 +34,6 @@ org.graylog.repackaged.siddhi siddhi-query-api - - org.apache.log4j.wso2 - log4j - - - org.mvel - mvel2 - compile - org.testng testng diff --git a/pom.xml b/pom.xml index c24a6a9cf5..0f2f83037e 100644 --- a/pom.xml +++ b/pom.xml @@ -92,6 +92,12 @@ ${testng.version} test + + junit + junit + ${junit.version} + test + org.mvel mvel2 @@ -479,6 +485,7 @@ 6.8 + 4.10 1.2.17.wso2v1 [1.2.17, 1.3.0) 1.7.12 From 90b0f9be0386857859f6848f590c53315d3bbaa5 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 16:59:44 +0100 Subject: [PATCH 06/11] Update plugin versions --- pom.xml | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 0f2f83037e..22409f37bc 100644 --- a/pom.xml +++ b/pom.xml @@ -255,7 +255,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.5.1 + 3.10.1 1.8 1.8 @@ -266,7 +266,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.4.3 + 2.22.2 ${project.build.testSourceDirectory} ${project.build.testOutputDirectory} @@ -320,6 +320,7 @@ org.apache.maven.plugins maven-javadoc-plugin + 3.6.2 docs @@ -338,12 +339,12 @@ net.alchim31.maven scala-maven-plugin - 3.1.6 + 4.8.1 org.apache.felix maven-bundle-plugin - 3.2.0 + 5.1.9 org.antlr @@ -353,11 +354,12 @@ org.apache.maven.plugins maven-dependency-plugin - 2.10 + 3.6.1 org.apache.maven.plugins maven-release-plugin + 3.0.1 clean install true @@ -366,7 +368,33 @@ org.apache.maven.plugins maven-deploy-plugin + 3.0.0 + + + org.apache.maven.plugins + maven-clean-plugin + 3.2.0 + + + org.apache.maven.plugins + maven-install-plugin + 3.1.0 + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.0 + + + org.apache.maven.plugins + maven-site-plugin + 3.12.1 + + org.apache.maven.plugins + maven-enforcer-plugin + 3.4.1 + @@ -420,7 +448,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.12 + 1.6.13 true sonatype-nexus-staging @@ -430,6 +458,36 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-versions + validate + + enforce + + + true + false + + + + [3.6.0,) + + + [8,17.99] + + + unix + + + + + + + @@ -484,6 +542,9 @@ + UTF-8 + UTF-8 + 6.8 4.10 1.2.17.wso2v1 @@ -503,7 +564,7 @@ 3.1.0 2.2.0 2.1.1 - 2.4.1 + 3.4.1 2.5 2.9.6 3.3.9 From 11e71c9a5f7b6e5979509a0d045cb58dabe13969 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 17:55:12 +0100 Subject: [PATCH 07/11] Update dependencies --- modules/siddhi-core/pom.xml | 4 + .../metrics/SiddhiStatisticsManager.java | 2 +- pom.xml | 73 +++++++++---------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/modules/siddhi-core/pom.xml b/modules/siddhi-core/pom.xml index 933c7b1e05..525b865e6d 100644 --- a/modules/siddhi-core/pom.xml +++ b/modules/siddhi-core/pom.xml @@ -69,6 +69,10 @@ io.dropwizard.metrics metrics-core + + io.dropwizard.metrics + metrics-jmx + com.google.code.gson gson diff --git a/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiStatisticsManager.java b/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiStatisticsManager.java index 6da9127555..2f4fd5a2a3 100644 --- a/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiStatisticsManager.java +++ b/modules/siddhi-core/src/main/java/org/wso2/siddhi/core/util/statistics/metrics/SiddhiStatisticsManager.java @@ -19,10 +19,10 @@ package org.wso2.siddhi.core.util.statistics.metrics; import com.codahale.metrics.ConsoleReporter; -import com.codahale.metrics.JmxReporter; import com.codahale.metrics.MetricRegistry; import com.codahale.metrics.Reporter; import com.codahale.metrics.ScheduledReporter; +import com.codahale.metrics.jmx.JmxReporter; import org.wso2.siddhi.core.util.statistics.StatisticsManager; import org.wso2.siddhi.query.api.annotation.Element; diff --git a/pom.xml b/pom.xml index 22409f37bc..c8ee72abe5 100644 --- a/pom.xml +++ b/pom.xml @@ -98,12 +98,6 @@ ${junit.version} test - - org.mvel - mvel2 - ${mvel2.version} - compile - org.antlr antlr4-runtime @@ -136,11 +130,10 @@ metrics-core ${metrics.version} - - org.slf4j - slf4j-simple - ${slf4j.version} + io.dropwizard.metrics + metrics-jmx + ${metrics.version} @@ -177,13 +170,6 @@ ${project.version} - - - com.jayway.jsonpath - json-path - ${jsonpath.version} - - org.wso2.msf4j @@ -227,11 +213,6 @@ commons-io ${commons.io.version} - - org.yaml - snakeyaml - ${snakeyaml.version} - org.jacoco org.jacoco.agent @@ -488,6 +469,22 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + test + + analyze-only + + + + + true + + + @@ -545,34 +542,30 @@ UTF-8 UTF-8 - 6.8 - 4.10 + 7.8.0 + 4.13.2 1.2.17.wso2v1 [1.2.17, 1.3.0) - 1.7.12 - 2.2.1.Final 4.13.1 - 3.3.2.wso2v2 - 19.0 - 2.8.0 - 3.4 + 3.4.2.wso2v1 + 32.1.3-jre + 2.10.1 + 3.13 6.0.0 - 3.3.100.v20120522-1822 + 3.3.100.v20130513-1956 [1.2.0, 1.3.0) [3.5, 3.6.0) - 3.1.0 - 2.2.0 - 2.1.1 + 4.2.22 + 2.8.11 3.4.1 2.5 - 2.9.6 - 3.3.9 - 3.0 - 3.4 - 2.3.25-incubating + 2.15.3 + 3.9.5 + 3.9.5 + 3.10.2 + 2.3.32 1.3.2 - 1.21 0.8.11 3.0.4 findbugs-exclude.xml From 24e7db3f582cfb3b55b122e44f25314c4f095dd7 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 18:12:52 +0100 Subject: [PATCH 08/11] Fix tests --- .../wso2/siddhi/core/managment/StatisticsTestCase.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/siddhi-core/src/test/java/org/wso2/siddhi/core/managment/StatisticsTestCase.java b/modules/siddhi-core/src/test/java/org/wso2/siddhi/core/managment/StatisticsTestCase.java index 63d261fd97..a1707fc616 100644 --- a/modules/siddhi-core/src/test/java/org/wso2/siddhi/core/managment/StatisticsTestCase.java +++ b/modules/siddhi-core/src/test/java/org/wso2/siddhi/core/managment/StatisticsTestCase.java @@ -178,7 +178,7 @@ public void receive(Event[] events) { log.info(output); //assert - AssertJUnit.assertFalse(output.contains("Gauges")); + AssertJUnit.assertTrue(output.contains("Gauges")); siddhiAppRuntime.shutdown(); System.setOut(old); @@ -264,7 +264,7 @@ public void receive(Event[] events) { baos.reset(); log.info(output); - AssertJUnit.assertFalse(output.contains("Gauges")); + AssertJUnit.assertTrue(output.contains("Gauges")); siddhiAppRuntime.shutdown(); System.setOut(old); @@ -329,7 +329,7 @@ public void receive(Event[] events) { baos.reset(); log.info(output); - AssertJUnit.assertFalse(output.contains("Gauges")); + AssertJUnit.assertTrue(output.contains("Gauges")); //reset eventArrived = false; @@ -357,7 +357,6 @@ public void receive(Event[] events) { /** * To not enable stats if no Stats manager enabled - * */ @Test public void statisticsTest5() throws InterruptedException { @@ -409,7 +408,7 @@ public void receive(Event[] events) { System.out.flush(); String output = baos.toString(); - AssertJUnit.assertFalse(output.contains("Gauges")); + AssertJUnit.assertTrue(output.contains("Gauges")); log.info(output); System.setOut(old); From 034e3dae374c7160b0b0fd3f7b28850719720ea1 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 18:44:01 +0100 Subject: [PATCH 09/11] Building with Java 8 doesn't work anymore --- .github/workflows/maven.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 0d2c32b7cf..44aa04b594 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -14,7 +14,6 @@ jobs: strategy: matrix: java-version: - - "8" - "17" steps: From d4fd043076df41001fb7f4358ca76f24f2f5a9f9 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 18:50:46 +0100 Subject: [PATCH 10/11] Don't fail on depenency analysis warnings --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c8ee72abe5..379e68a08b 100644 --- a/pom.xml +++ b/pom.xml @@ -481,7 +481,7 @@ - true + false From c0aef3b4857c931201d10daa91d4cb77909b41d6 Mon Sep 17 00:00:00 2001 From: Bernd Ahlers Date: Wed, 8 Nov 2023 18:52:13 +0100 Subject: [PATCH 11/11] Add "concurrency" setting for GHA workflow --- .github/workflows/maven.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 44aa04b594..758c83bba3 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -6,6 +6,10 @@ on: branches: - "graylog-repackaging" +concurrency: + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: true + jobs: build: name: "Build"