Home » Java

Java

Reactive’s Looming Doom. Part I: Evolution

1. Introduction Multithreading in Java has come a long evolutionary way from the original monitor concept and threads mapped to native OS threads to modern asynchronous libraries and implementation of lightweight threads (formerly “fibers”) as part of Project Loom. At the same time, while the language was evolving, the community was developing its own frameworks and practices. With the release ...

Read More »

Smaller Try-Blocks Are Better

It often happens, especially in Java, that a few places in the method are potential exception originators. Usually, we make a large method-size try block with a single catch at the bottom. We catch all the exceptions, usually even using grouping. This helps us minimize the noise, which is the exception catching. However, such large try blocks jeopardize maintainability: we ...

Read More »

Troubleshooting deadlock in an Apache opensource library

java-interview-questions-answers

Apache PDFBox is a popular open-source library that facilitates java applications to work with PDF documents. Recently we encountered a Deadlock that surfaced in this library. In this post we have shared how we troubleshooted and identified the root cause of the problem. What is Deadlock? First let’s try to understand what ‘Deadlock’ means. Several technical definitions aren’t clear. ‘Deadlock’ ...

Read More »

Skaffold for Local Java App Development

java-interview-questions-answers

Skaffold is a tool which handles the workflow of building, pushing and deploying container images and has the added benefit of facilitating an excellent local dev loop.  In this post I will be exploring using Skaffold for local development of a Java based application Installing Skaffold Installing Skaffold locally is straightforward, and explained well here. It works great with minikube as a local ...

Read More »

Chaos Engineering – Metaspace OutOfMemoryError

JVM memory has following regions:  a. Young Generation b. Old Generation c. Metaspace d. Others region When you encounter ‘java.lang.OutOfMemoryError: Metaspace’ it indicates that the Metaspace region in the JVM memory is getting saturated. Metaspace is the region where metadata details that are required to execute your application are stored. In nutshell they contain Class definitions and method definitions of ...

Read More »

Inspect the contents of the Java Metaspace region

JVM Memory has following regions: a. Young Generation b. Old Generation c. Metaspace d. Others region To see what objects are stored in what region, you may refer to this video clip. Sometimes your application might run into ‘java.lang.OutOfMemoryError: Metaspace’ as discussed in this post. In such circumstances you might want to see what are the Contents loaded in the ...

Read More »

Java String intern(): Performance impact

java.lang.String#intern() is an interesting function in Java. When used at the right place, it has potential to reduce overall memory consumption of your application by eliminating duplicate strings in your application. To learn how intern() function works, you may refer to this blog. In this post let’s discuss the performance impact of using java.lang.String#intern() function in your application. intern() function ...

Read More »

In which region intern strings are stored?

intern() is an interesting function in java.lang.String object. intern() function eliminates duplicate string objects from the application and has potential to reduce overall memory consumption of your application. To understand how string intern() function works you may refer to this interesting blog. Intern strings are stored in a string pool in the JVM memory. JVM Memory has following regions: a. ...

Read More »

Garbage Collection CPU Statistics

When a Garbage Collection event runs, it spends a predominant amount of its time in the Java application layer. It also spends a certain portion of its time in the Operating System/Kernel layer.  ‘User’ Time: Amount of time Garbage Collector spends in the Java application layer is reported as ‘User’ time in the GCeasy report. Here are the reasons for ...

Read More »