Use Java 11 in graphadmin 60/138960/1 1.14.7
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 18 Sep 2024 14:06:17 +0000 (16:06 +0200)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Wed, 18 Sep 2024 14:06:17 +0000 (16:06 +0200)
- switch compiler version and base image to Java 11
- remove com.sun.jersey (Jersey 1) dependencies
- replace heap_size jvm args with MaxRAMPercentage to scale dynamically with the K8s limits

Issue-ID: AAI-4001
Change-Id: I17d126cf9972bad4c851a374113845be77fee9f6
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
onap-java-formatter.xml
pom.xml
src/main/docker/Dockerfile
src/main/docker/docker-entrypoint.sh
src/main/java/org/onap/aai/db/schema/AuditDoc.java
src/main/java/org/onap/aai/db/schema/EdgeProperty.java
src/main/java/org/onap/aai/db/schema/ScriptDriver.java
src/main/java/org/onap/aai/web/JerseyConfiguration.java
src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java

index 920d37b..29dbb9a 100644 (file)
@@ -2,11 +2,11 @@
 <profiles version="12">
 <profile kind="CodeFormatterProfile" name="onap-java-formatter" version="12">
 <setting id="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value="enabled"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.8"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.8"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="11"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance" value="11"/>
 <setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
 <setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.8"/>
+<setting id="org.eclipse.jdt.core.compiler.source" value="11"/>
 <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
 <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
 <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="48"/>
diff --git a/pom.xml b/pom.xml
index 1c4765e..7f2b5f3 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.aai.aai-common</groupId>
         <artifactId>aai-parent</artifactId>
-        <version>1.14.6</version>
+        <version>1.14.7</version>
     </parent>
     <groupId>org.onap.aai.graphadmin</groupId>
     <artifactId>aai-graphadmin</artifactId>
@@ -35,9 +35,9 @@
     <properties>
 
         <!-- Start of Compiler Related Properties -->
-        <java.version>1.8</java.version>
-        <maven.compiler.source>1.8</maven.compiler.source>
-        <maven.compiler.target>1.8</maven.compiler.target>
+        <java.version>11</java.version>
+        <maven.compiler.source>11</maven.compiler.source>
+        <maven.compiler.target>11</maven.compiler.target>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <!-- End of Compiler Related Properties -->
 
@@ -55,7 +55,7 @@
         <docker.push.registry>localhost:5000</docker.push.registry>
         <aai.docker.version>1.0.0</aai.docker.version>
         <aai.schema.service.version>1.12.5</aai.schema.service.version>
-        <aai.common.version>1.14.6</aai.common.version>
+        <aai.common.version>1.14.7</aai.common.version>
         <aai.build.directory>${project.build.directory}/${project.artifactId}-${project.version}-build/
         </aai.build.directory>
         <aai.docker.namespace>onap</aai.docker.namespace>
                     <groupId>org.onap.aai.aai-common</groupId>
                     <artifactId>aai-aaf-auth</artifactId>
                 </exclusion>
-                <exclusion>
-                    <groupId>com.sun.jersey</groupId>
-                    <artifactId>jersey-core</artifactId>
-                </exclusion>
                 <exclusion>
                     <groupId>org.slf4j</groupId>
                     <artifactId>slf4j-log4j12</artifactId>
             <artifactId>activemq-client</artifactId>
             <version>${activemq.version}</version>
         </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-client</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jersey</groupId>
-            <artifactId>jersey-json</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.codehaus.jackson</groupId>
-                    <artifactId>jackson-mapper-asl</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
         <!-- Do not use the jersey-client since jersey client 1.0 version clashes
             with jersey 2 which we are using -->
         <!-- Use this to make http requests instead of jersey 1.0 client -->
index 88faf79..6fb1cd3 100755 (executable)
@@ -1,4 +1,4 @@
-FROM eclipse-temurin:8-jre-alpine
+FROM eclipse-temurin:11-jre-alpine
 USER root
 ENV SERVER_PORT=8449
 EXPOSE ${SERVER_PORT}
index 9232398..d80eea5 100644 (file)
@@ -45,19 +45,12 @@ if [ -f ${APP_HOME}/resources/aai-graphadmin-swm-vars.sh ]; then
     source ${APP_HOME}/resources/aai-graphadmin-swm-vars.sh;
 fi;
 
-MIN_HEAP_SIZE=${MIN_HEAP_SIZE:-512m};
-MAX_HEAP_SIZE=${MAX_HEAP_SIZE:-1024m};
 MAX_METASPACE_SIZE=${MAX_METASPACE_SIZE:-512m};
 
 JAVA_CMD="exec java";
 
-JVM_OPTS="${PRE_JVM_ARGS} -Xloggc:/opt/app/aai-graphadmin/logs/gc/aai_gc.log";
 JVM_OPTS="${JVM_OPTS} -XX:HeapDumpPath=/opt/app/aai-graphadmin/logs/ajsc-jetty/heap-dump";
-JVM_OPTS="${JVM_OPTS} -Xms${MIN_HEAP_SIZE}";
-JVM_OPTS="${JVM_OPTS} -Xmx${MAX_HEAP_SIZE}";
-
-JVM_OPTS="${JVM_OPTS} -XX:+PrintGCDetails";
-JVM_OPTS="${JVM_OPTS} -XX:+PrintGCTimeStamps";
+JVM_OPTS="${JVM_OPTS} -XX:MaxRAMPercentage=${MAX_RAM_PERCENTAGE:-60}";
 JVM_OPTS="${JVM_OPTS} -XX:MaxMetaspaceSize=${MAX_METASPACE_SIZE}";
 
 JVM_OPTS="${JVM_OPTS} -server";
@@ -65,16 +58,12 @@ JVM_OPTS="${JVM_OPTS} -XX:NewSize=512m";
 JVM_OPTS="${JVM_OPTS} -XX:MaxNewSize=512m";
 JVM_OPTS="${JVM_OPTS} -XX:SurvivorRatio=8";
 JVM_OPTS="${JVM_OPTS} -XX:+DisableExplicitGC";
-JVM_OPTS="${JVM_OPTS} -verbose:gc";
-JVM_OPTS="${JVM_OPTS} -XX:+UseParNewGC";
+JVM_OPTS="${JVM_OPTS} -XX:+UseG1GC";
 JVM_OPTS="${JVM_OPTS} -XX:+CMSParallelRemarkEnabled";
 JVM_OPTS="${JVM_OPTS} -XX:+CMSClassUnloadingEnabled";
-JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC";
 JVM_OPTS="${JVM_OPTS} -XX:-UseBiasedLocking";
 JVM_OPTS="${JVM_OPTS} -XX:ParallelGCThreads=4";
 JVM_OPTS="${JVM_OPTS} -XX:LargePageSizeInBytes=128m";
-JVM_OPTS="${JVM_OPTS} -XX:+PrintGCDetails";
-JVM_OPTS="${JVM_OPTS} -XX:+PrintGCTimeStamps";
 JVM_OPTS="${JVM_OPTS} -Dsun.net.inetaddr.ttl=180";
 JVM_OPTS="${JVM_OPTS} -XX:+HeapDumpOnOutOfMemoryError";
 JVM_OPTS="${JVM_OPTS} ${POST_JVM_ARGS}";
index 2beec12..0d828ca 100644 (file)
  */
 package org.onap.aai.db.schema;
 
-import org.codehaus.jackson.annotate.JsonProperty;
-
 import java.util.List;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 public class AuditDoc {
 
        private List<DBProperty> properties;
        private List<DBIndex> indexes;
        private List<EdgeProperty> edgeLabels;
-       
+
        /**
         * Gets the properties.
         *
@@ -37,7 +37,7 @@ public class AuditDoc {
        public List<DBProperty> getProperties() {
                return properties;
        }
-       
+
        /**
         * Sets the properties.
         *
@@ -46,7 +46,7 @@ public class AuditDoc {
        public void setProperties(List<DBProperty> properties) {
                this.properties = properties;
        }
-       
+
        /**
         * Gets the indexes.
         *
@@ -55,7 +55,7 @@ public class AuditDoc {
        public List<DBIndex> getIndexes() {
                return indexes;
        }
-       
+
        /**
         * Sets the indexes.
         *
@@ -64,17 +64,17 @@ public class AuditDoc {
        public void setIndexes(List<DBIndex> indexes) {
                this.indexes = indexes;
        }
-    
-    /**
-     * Gets the edge labels.
-     *
-     * @return the edge labels
-     */
-    @JsonProperty("edge-labels")
+
+       /**
+        * Gets the edge labels.
+        *
+        * @return the edge labels
+        */
+       @JsonProperty("edge-labels")
        public List<EdgeProperty> getEdgeLabels() {
                return edgeLabels;
        }
-       
+
        /**
         * Sets the edge labels.
         *
@@ -83,6 +83,4 @@ public class AuditDoc {
        public void setEdgeLabels(List<EdgeProperty> edgeLabels) {
                this.edgeLabels = edgeLabels;
        }
-       
-       
 }
index f89bc8f..7b1dd4b 100644 (file)
  */
 package org.onap.aai.db.schema;
 
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.annotate.JsonPropertyOrder;
 import org.janusgraph.core.Multiplicity;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
 @JsonPropertyOrder({ "label", "multiplicity" })
 public class EdgeProperty implements Named {
 
        private String name = null;
        private Multiplicity multiplicity = null;
-       
+
     /**
      * Gets the name
      */
-    @JsonProperty("label")
+  @JsonProperty("label")
        public String getName() {
                return name;
        }
-    
-    /**
-     * Sets the name.
-     *
-     * @param name the new name
-     */
-    @JsonProperty("label")
+
+       /**
+        * Sets the name.
+        *
+        * @param name the new name
+        */
+  @JsonProperty("label")
        public void setName(String name) {
                this.name = name;
        }
-       
+
        /**
         * Gets the multiplicity.
         *
@@ -55,7 +56,7 @@ public class EdgeProperty implements Named {
        public Multiplicity getMultiplicity() {
                return multiplicity;
        }
-       
+
        /**
         * Sets the multiplicity.
         *
@@ -64,5 +65,5 @@ public class EdgeProperty implements Named {
        public void setMultiplicity(Multiplicity multiplicity) {
                this.multiplicity = multiplicity;
        }
-       
+
 }
index 88c9bf9..073ca59 100644 (file)
@@ -23,7 +23,6 @@ import com.beust.jcommander.JCommander;
 import com.beust.jcommander.Parameter;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.commons.configuration2.PropertiesConfiguration;
-import org.codehaus.jackson.JsonGenerationException;
 import org.janusgraph.core.JanusGraph;
 import org.janusgraph.core.JanusGraphFactory;
 import org.onap.aai.restclient.PropertyPasswordConfiguration;
index 7da90c0..99f304d 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.onap.aai.web;
 
-import com.sun.jersey.api.client.filter.LoggingFilter;
 import java.util.List;
 import java.util.Set;
 import java.util.logging.Logger;
@@ -27,6 +26,7 @@ import java.util.stream.Collectors;
 import javax.annotation.Priority;
 import javax.ws.rs.container.ContainerRequestFilter;
 import javax.ws.rs.container.ContainerResponseFilter;
+import org.glassfish.jersey.logging.LoggingFeature;
 import org.glassfish.jersey.server.ResourceConfig;
 import org.glassfish.jersey.servlet.ServletProperties;
 import org.onap.aai.rest.AuditSqlDbConsumer;
@@ -65,7 +65,7 @@ public class JerseyConfiguration extends ResourceConfig {
         // Following registers the request headers and response headers
         // If the LoggingFilter second argument is set to true, it will print response value as well
         if ("true".equalsIgnoreCase(env.getProperty("aai.request.logging.enabled"))) {
-            register(new LoggingFilter(log, 0));
+            register(new LoggingFeature(log));
         }
     }
 
index 23c3352..b7bb9c4 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.onap.aai.schema.db;
 
-import org.codehaus.jackson.JsonParseException;
 import org.janusgraph.core.JanusGraph;
 import org.janusgraph.core.JanusGraphFactory;
 import org.janusgraph.core.schema.JanusGraphManagement;
@@ -31,6 +30,7 @@ import org.onap.aai.AAISetup;
 import org.onap.aai.db.schema.DBIndex;
 import org.onap.aai.db.schema.ManageJanusGraphSchema;
 
+import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;