Home » Author Archives: Xavier Padro

Author Archives: Xavier Padro

Xavier is a software developer working in a consulting firm based in Barcelona. He is specialized in web application development with experience in both frontend and backend. He is interested in everything related to Java and the Spring framework.

Understanding Callable and Spring DeferredResult

spring-interview-questions-answers

1. Introduction Asynchronous support introduced in Servlet 3.0 offers the possibility to process an HTTP request in another thread. This is specially interesting when you have a long running task, since while another thread processes this request, the container thread is freed and can continue serving other requests. This topic has been explained many times, but there seems to be ...

Read More »

Improving performance: non-blocking processing of streams

spring-interview-questions-answers

1. Introduction Imagine we have an application that needs to access an external web service in order to gather information about clients and then process it. More specifically, we can’t get all this information in a single invocation. If we want to look up different clients, we will need several invocations. As shown in the graphic below, the example application ...

Read More »

Java Concurrency Tutorial – Locking: Explicit locks

java-logo

1. Introduction In many cases, using implicit locking is enough. Other times, we will need more complex functionalities. In such cases, java.util.concurrent.locks package provides us with lock objects. When it comes to memory synchronization, the internal mechanism of these locks is the same as with implicit locks. The difference is that explicit locks offer additional features. The main advantages or ...

Read More »

Exposing HTTP Restful API with Inbound Adapters. Part 1 (XML)

spring-interview-questions-answers

1. Introduction The purpose of this post is to implement an HTTP Restful API using Spring Integration HTTP inbound adapters. This tutorial is divided into two parts:               XML configuration example (this same post). Java DSL example. This will be explained in the next part of this tutorial, showing how to configure the application ...

Read More »

Java Concurrency Tutorial – Locking: Intrinsic locks

java-logo

In previous posts we reviewed some of the main risks of sharing data between different threads (like atomicity and visibility) and how to design classes in order to be shared safely (thread-safe designs). In many situations though, we will need to share mutable data, where some threads will write and others will act as readers. It may be the case ...

Read More »

Java Concurrency Tutorial – Thread-safe designs

java-logo

After reviewing what the main risks are when dealing with concurrent programs (like atomicity or visibility), we will go through some class designs that will help us prevent the aforementioned bugs. Some of these designs result in the construction of thread-safe objects, allowing us to share them safely between threads. As an example, we will consider immutable and stateless objects. ...

Read More »

Java Concurrency Tutorial – Visibility between threads

java-logo

When sharing an object’s state between different threads, other issues besides atomicity come into play. One of them is visibility. The key fact is that without synchronization, instructions are not guaranteed to be executed in the order in which they appear in your source code. This won’t affect the result in a single-threaded program but, in a multi-threaded program, it ...

Read More »

Java Concurrency Tutorial – Atomicity and race conditions

java-logo

Atomicity is one of the key concepts in multi-threaded programs. We say a set of actions is atomic if they all execute as a single operation, in an indivisible manner. Taking for granted that a set of actions in a multi-threaded program will be executed serially may lead to incorrect results. The reason is due to thread interference, which means ...

Read More »

Spring Integration 4.0: A complete XML-free example

spring-interview-questions-answers

1. Introduction Spring Integration 4.0 is finally here, and this release comes with very nice features. The one covered in this article is the possibility to configure an integration flow without using XML at all. Those people that don’t like XML will be able to develop an integration application with just using JavaConfig. This article is divided in the following ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.