Skip to content

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 &#…

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.

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 ge…

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/as…