In this post, we are going to discuss a non-intrusive approach (i.e., approach that doesn’t add any noticeable overhead to the application) to diagnose CPU spike. Thus, you can use this approach in your production environment to troubleshoot CPU spikes. Works on all JVM languages: This approach can be used to troubleshoot CPU spikes in... Continue Reading →
Pitfalls to avoid when switching to Virtual threads
Java virtual thread is a new feature available from JDK 19. It has potential to improve the application’s availability, throughput and code quality on top of reducing memory consumption. If you are interested in learning more about Java virtual thread, here is a quick introduction to it. Video: To see the visual walk-through of this... Continue Reading →
ThreadLocal – easy introduction
There are scopes of variable in Java programming language: a. Local variable b. Member variable (aka instance variable) c. Static variable (aka class variable) In this post, let's discuss an interesting type of variable: ThreadLocal and how it differs from the other variable types. Video: To see the visual walk-through of this post, click below: https://youtu.be/qHehLjo1aNk... Continue Reading →
Clear details on Java collection ‘Clear()’ API
Several of us might be familiar with the clear () API in Java collections framework. In this post, let's discuss what is the purpose of this clear() API? What is the performance impact of using this API? What happens under the JVM when this API is invoked? Video: To see the visual walk-through of this post,... Continue Reading →
Synchronized method – Boy Friend Threads & Girl Friend Object
When a method is synchronized, only one thread can enter that object's method at a given point in time. If any other thread tries to enter the synchronized method, it will NOT be allowed to enter. It will be put in the BLOCKED state. In this post, let’s learn a little more details about synchronized... Continue Reading →
Can threads execute different synchronized methods on same object?
In our earlier post, we learnt that when a method is synchronized only one thread will be allowed to enter the method. In this post, let's do a little bit of deep dive - What would happen if an object has two synchronized methods? When a thread is executing the first synchronized method, will another... Continue Reading →
Java Static Synchronized method behavior
In our earlier post, we learnt that when a method is synchronized, only one thread will be allowed to enter the method. In this post, let's discuss the behavior of static synchronized methods. Video: To see the visual walk-through of this post, click below: https://youtu.be/YFNklSkT1js Multiple static synchronized methods in a same object example To facilitate... Continue Reading →
Java synchronized block
In the earlier post we learnt about the Java synchronized method. In this post, let's learn about the synchronized block. Video: To see the visual walk-through of this post, click below: https://youtu.be/NIeEiK_eklE What is Synchronized Block? Synchronized block is used to prevent multiple threads from executing a portion of a code in a method at the... Continue Reading →
Can threads execute same synchronized method on different objects?
In our earlier post, we learnt that when a method is synchronized, only one thread will be allowed to enter the method. In this post, let's do a little bit of deep dive - let’s discuss whether threads can invoke the same synchronized method on different objects at the same point in time. Video: To see... Continue Reading →
JVM arguments master sheet
This is a master sheet with most of the JVM arguments: JVM ArgumentDescription-XbatchDisables background compilation so that compilation of all methods proceeds as a foreground task until completed. To learn more click here.-Xbootclasspath:<paths>Specifies a list of directories, JAR files, and ZIP archives separated by colons (:) in Unix and semicolons (;) in Windows to search for... Continue Reading →