I am testing the new zgc garbage collector that was included in java 11 since it promises really low latency. Our application is a real-time service that creates and destroys many objects per second and it does it in a multi-threaded environment using akka. When enabling zgc by passing the options -XX:+UnlockExperimentalVMOptions -XX:+UseZGC and enabling gc logs, we can see
How do I set up an AWS S3 Object Redirect via the Java SDK
I’m asking this question in order to answer it and point others in the right direction faster then I got there. I spent far too long looking for the answer as most S3 Object Redirection questions and their answers had to do with the technical detail of confusing the S3 bucket access point for the S3 website access point. What,
How to verify that a string is JWT token?
In Java How can we verify that i given String is a JWT Token without using Signature? I am using This works fine but I want to verify this without SECRET_KEY. I Just want to verify whether it is a JWT token or not. Answer Here is an example to check the structure of the JWT. You only need to
Run ES docker image with custom port using testcontainers
I want to run a container tests that running ES image via Docker. After some research I found https://www.testcontainers.org/ and they also have a built-it ES module. Because my development environment using ES in ports 9200 and 9300 I prefer to use another ports for my tests, let’s say 1200 and 1300. Therefore, to run the docker image from CLI
ArrayList method logic issue
I’m trying to execute my ArrayList method but it seems that it only grabs the first data. public class CoronavirusUpdateMain { public static void main(String []args) { Scanner …
ArrayList gets overwritten everytime a new instance is created
I’m a new programmer, I’m terribly sorry for the walls of code, but I simply can’t find the error. I am tring to create an arrayList that stores input values, but everytime I create the 2nd instance, the first instance gets overwritten. It does print two instances, but both instances have the same value. Main block: The problem area is
How to send a list of custom objects over a socket?
How can I send elements of this ArrayList over a socket from a client to a server? I tried some structures but all needed one String to send. Answer The easiest way is to use object streams. In order to do this, shapeInfo should be Serializable: Then, you can send it using an ObjectOutputStream: On the other side, you can
When should we call join() after ForkJoinTask.invokeAll()
The API says: “Method invokeAll (available in multiple versions) performs the most common form of parallel invocation: forking a set of tasks and joining them all.” So my assumption is if I use …
How to validate spaces between two words using regex in a string [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I am trying to validate string to accept spaces between two words (in the middle). I want a regex that will accept “hello world”. I
Using Java Optional in Kotlin DTOs
Currently I’m using Java 8’s Optional in my Kotlin DTOs as follows: The purpose of it is that for some properties like prop2 I want to also allow delete in the request. So the value of prop2 in the DTO is understood as follows: null => do nothing non-empty optional => update value empty optional => delete value (set value