Suppose you are tasked with writing tests for a Spring and Hibernate application. This application uses a mix of native queries, HQL or entity associations to fetch data from the …
[Read more]
Using thread dumps to analyse deadlocks
In a multi-threaded Java application, a deadlock occurs when two threads wait forever attempting to acquire locks that are held by each other. Here’s a simple example to simulate a …
[Read more]
Running time intensive operations in parallel with RxJava Observables
Recently I delved into the RxJava library. In this post I will demonstrate how RxJava Observables can be used to execute two long running tasks in parallel, so as to reduce their …
[Read more]
Logging with Spring AOP
Aspect oriented programming (AOP) is a way of separating the business login in your code from cross cutting concerns. What is a cross cutting concern?
Analogy time. A typical house …
[Read more]
Memory profiling – simple examples
Recently I have been trying to learn different memory profiling tools to monitor Java applications. I have looked into the command line tools that are shipped as part of JDK like …
[Read more]
JPA Entity Relationships
In a relational database, the relationships between two tables are defined by foreign keys. Typically, one table has a column that contains the primary key of another table’s row. …
[Read more]
Introduction to jdb
jdb (Java Debugger) is a simple command-line debugger for Java classes that is provided as part of the JDK tools and utilities.
jdb is based on a server-client model. While …
[Read more]
Step by step guide to set up a service discovery environment
In a microservices environment we can run multiple instances of a service for resilience and scalability. In a cloud environment these instances can go up and down arbitrarily. So …
[Read more]
How to set up a local spring cloud config server
From the official documentation,
Spring Cloud Config provides server and client-side support for externalized configuration in a distributed system. With the Config Server you have …
[Read more]
Building with Gradle
Gradle is a popular build tool to manage Java projects. Gradle’s build scripts are written in Groovy. The design of Gradle is aimed to be used as a language, not as a rigid …
[Read more]