Home » Java

Java

Synchronized Decorators to Replace Thread-Safe Classes

You know what thread safety is, right? If not, there is a simple example below. All classes must be thread-safe, right? Not really. Some of them have to be thread-safe? Wrong again. I think none of them have to be thread-safe, while all of them have to provide synchronized decorators.               Let’s start with ...

Read More »

Expected Exception Rule and Mocking Static Methods – JUnit

Today I was asked to consume a RESTful service so I started implementing it following Robert Cecil Martin’s rules for TDD and came across a new way (atleast for me) of testing the expected exception along with the error message so thought of sharing the way I implemented it as part of this post. To start with let’s write a ...

Read More »

Performance Tuning of an Apache Kafka/Spark Streaming System

Real-world case study in the telecom industry Debugging a real-life distributed application can be a pretty daunting task. Most common Google searches don’t turn out to be very useful, at least at first. In this blog post, I will give a fairly detailed account of how we managed to accelerate by almost 10x an Apache Kafka/Spark Streaming/Apache Ignite application and ...

Read More »

Spring-Boot and Cache Abstraction with HazelCast

spring-interview-questions-answers

Previously we got started with Spring Cache abstraction using the default Cache Manager that spring provides. Although this approach might suit our needs for simple applications, in case of complex problems we need to use different tools with more capabilities. Hazelcast is one of them. Hazelcast is hands down a great caching tool when it comes to a JVM based ...

Read More »

Lazy-loading is a Code Smell

Have you ever seen those huge objects with many attributes? These domain objects where we are using lazy-loading because we do not want to retrieve too much information from the database? I bet you’ve had this doubtful pleasure. Today I want to share with you my impressions about them – using lazy-loading should be treated as a code smell! Let me ...

Read More »

Spring Cloud Contracts and Spring Cloud Services on PCF

spring-interview-questions-answers

We had a customer recently who were quite interested in the idea of using Spring Cloud Contract (SCC) in order to prevent API ‘drift’ between microservices teams where individual development teams look after the individual API’s that form part of an enterprise application. Spring Cloud Contract is an implementation of the ‘Consumer Driven Contracts‘ concept for the Spring platform. From the ...

Read More »

Develop A Microservice with Forge, WildFly Swarm and Arquillian

In this post we are going to see how to develop a microservice using WildFly Swarm and Forge and testing it with Arquillian and Rest Assured. WildFly Swarm offers an innovative approach to packaging and running Java EE applications by packaging them with just enough of the server runtime to “java -jar” your application. JBoss Forge is a software development ...

Read More »

Better Complex Event Processing at Scale Using a Microservices-based Streaming Architecture (Part 1)

java-interview-questions-answers

A microservice-based streaming architecture combined with an open source rule engine makes real-time business rules easy This post is intended as a detailed account of a project I have made to integrate an OSS business rules engine with a modern stream messaging system in the Kafka style. The goal of the project, better known as Complex Event Processing (CEP), is ...

Read More »

Extracting JavaDoc documentation from source files using JavaParser

A lot of people are using JavaParser for the most different goals. One of these is extracting documentation. In this short post we will see how you can print all the JavaDoc comments associated to classes or interfaces. Code is available on GitHub: https://github.com/ftomassetti/javadoc-extractor Getting all the Javadoc comments for classes We are reusing DirExplorer, a supporting class presented in the introduction ...

Read More »

Spring boot and Cache Abstraction

spring-interview-questions-answers

Caching is a major ingredient of most applications, and as long as we try to avoid disk access it will stay strong. Spring has great support for caching with a wide range of configurations. You can start as simple as you want and progress to something much more customizable. This would be an example with the simplest form of caching ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns