Skip to content
Advertisement

Tag: java-11

Make ZGC run often

ZGC runs not often enough. GC logs show that it runs once every 2-3 minutes for my application and because of this, my memory usage goes high between GC cycles (as high as 90%). After GC, it drops to as low as 20%. How to increase GC run’s frequency to run more often? Answer -XX:ZCollectionInterval=N – set maximum gap between

Java convert DateTime from “yyyy-MM-dd HH:mm:ss.SSSSSSS” to “yyyy-MM-dd HH:mm:ss.S” or from “yyyy-MM-dd HH:mm:ss.SSSSSSS” to “yyyy-MM-dd HH:mm:ss.SSS”

Java 11 I want to convert the date in “yyyy-MM-dd HH:mm:ss.SSSSSSS” to either “yyyy-MM-dd HH:mm:ss.S” or “yyyy-MM-dd HH:mm:ss.SSS” based on milliseconds value. If milliseconds are all zeros, then I just want single zero but if it is non-zero value then I want just value omitting trailing zeros. Example : Input : 2021-03-10 16:37:02.4230000 => Desired Output : 2021-03-10 16:37:02.423 Input : 2021-03-10 16:39:51.0000000

Java 8 edit stream elements

I need to filter and modify the values of the filtered object. The logic that must be filtered is given below. I have tried it like this. But how can we set the value of isUpdated = true using java 8? Answer Base on the logic given, findFirst should be used as you stop after the first instance is found.

Which version of OpenJFX (JavaFX) and Scene Builder should I use with Amazon Corretto 11 (OpenJDK)?

In your opinion, what is the best version of OpenJFX (JavaFX) and Scene Builder should I use with Amazon Corretto 11 (OpenJDK)? Currently, until the date of this post, there are 2 versions of OpenJFX (JavaFX) and 2 versions of Scene Builder: Gluon’s JavaFX versions: JavaFX 11 LTS JavaFX 16 Latest Release Gluon’s Scene Builder versions: Scene Builder 16 Scene

Deprecated Short(String) how to update?

I’m handling this problem: Short appears deprecated with a mark. How can I update this for above Java 9 versions? (Now, I have Java 11) Answer You shall use Short.valueOf. This is taken from the javadoc Deprecated. It is rarely appropriate to use this constructor. The static factory valueOf(short) is generally a better choice, as it is likely to yield

Executing the single code java file using java Vs javac using jdk11

I am using JDK11. Below is my sample class – I executed the above class with command “java filename.java” for below scenarios ColumnA -> Class declared as public? ColumnB -> File name same as class name? For all the scenarios, the command executed successfully and I got the result. I get compile-time error for the “Yes-No” case, if I run

Is it possible to exclude field-sets in AspectJ

Is it possible to exclude fiel-sets in AspectJ pointcuts, so instrumentation does not stumble over final fields in Java 11? When weaving the following aspect (the full example is here: https://github.com/DaGeRe/aspect-final-example): into by java -cp target/test-0.1-SNAPSHOT.jar -javaagent:../aspect/target/aspectjtest-0.1-SNAPSHOT.jar de.test.MainWithError I get when I execute it with OpenJDK 11 (when setting everything to Java 8, it works fine). When removing the final

Advertisement