diff options
author | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-09-18 16:06:17 +0200 |
---|---|---|
committer | Fiete Ostkamp <Fiete.Ostkamp@telekom.de> | 2024-09-18 16:06:17 +0200 |
commit | 03d5651e76a712af7a0ee04050e42b80dc43704b (patch) | |
tree | 794b1078ef73bb11fb48e2d5c5fb30b2b7ead9a2 | |
parent | 610846c7e9e48806073e15ede8e502119c587ca3 (diff) |
Use Java 11 in graphadmin1.14.7
- 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>
-rw-r--r-- | onap-java-formatter.xml | 6 | ||||
-rwxr-xr-x | pom.xml | 28 | ||||
-rwxr-xr-x | src/main/docker/Dockerfile | 2 | ||||
-rw-r--r-- | src/main/docker/docker-entrypoint.sh | 15 | ||||
-rw-r--r-- | src/main/java/org/onap/aai/db/schema/AuditDoc.java | 30 | ||||
-rw-r--r-- | src/main/java/org/onap/aai/db/schema/EdgeProperty.java | 29 | ||||
-rw-r--r-- | src/main/java/org/onap/aai/db/schema/ScriptDriver.java | 1 | ||||
-rw-r--r-- | src/main/java/org/onap/aai/web/JerseyConfiguration.java | 4 | ||||
-rw-r--r-- | src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java | 2 |
9 files changed, 43 insertions, 74 deletions
diff --git a/onap-java-formatter.xml b/onap-java-formatter.xml index 920d37b..29dbb9a 100644 --- a/onap-java-formatter.xml +++ b/onap-java-formatter.xml @@ -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"/> @@ -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> @@ -385,10 +385,6 @@ <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> </exclusion> @@ -542,20 +538,6 @@ <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 --> diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 88faf79..6fb1cd3 100755 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -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} diff --git a/src/main/docker/docker-entrypoint.sh b/src/main/docker/docker-entrypoint.sh index 9232398..d80eea5 100644 --- a/src/main/docker/docker-entrypoint.sh +++ b/src/main/docker/docker-entrypoint.sh @@ -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}"; diff --git a/src/main/java/org/onap/aai/db/schema/AuditDoc.java b/src/main/java/org/onap/aai/db/schema/AuditDoc.java index 2beec12..0d828ca 100644 --- a/src/main/java/org/onap/aai/db/schema/AuditDoc.java +++ b/src/main/java/org/onap/aai/db/schema/AuditDoc.java @@ -19,16 +19,16 @@ */ 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; } - - } diff --git a/src/main/java/org/onap/aai/db/schema/EdgeProperty.java b/src/main/java/org/onap/aai/db/schema/EdgeProperty.java index f89bc8f..7b1dd4b 100644 --- a/src/main/java/org/onap/aai/db/schema/EdgeProperty.java +++ b/src/main/java/org/onap/aai/db/schema/EdgeProperty.java @@ -19,34 +19,35 @@ */ 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; } - + } diff --git a/src/main/java/org/onap/aai/db/schema/ScriptDriver.java b/src/main/java/org/onap/aai/db/schema/ScriptDriver.java index 88c9bf9..073ca59 100644 --- a/src/main/java/org/onap/aai/db/schema/ScriptDriver.java +++ b/src/main/java/org/onap/aai/db/schema/ScriptDriver.java @@ -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; diff --git a/src/main/java/org/onap/aai/web/JerseyConfiguration.java b/src/main/java/org/onap/aai/web/JerseyConfiguration.java index 7da90c0..99f304d 100644 --- a/src/main/java/org/onap/aai/web/JerseyConfiguration.java +++ b/src/main/java/org/onap/aai/web/JerseyConfiguration.java @@ -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)); } } diff --git a/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java b/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java index 23c3352..b7bb9c4 100644 --- a/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java +++ b/src/test/java/org/onap/aai/schema/db/ManageSchemaTest.java @@ -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; |