Java Concurrency Tutorial – Locking: Explicit locks

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…

Exposing HTTP Restful API with Inbound Adapters. Part 2 (Java DSL)

1 Introduction In the previous part of this tutorial, we implemented an application exposing a Restful API using XML configuration. This part will re-implement this application using Spring Integration Java DSL. The application is implemented with Java 8, but when Java 8 specific code is used (for example, when using…

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

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…

Java Concurrency Tutorial – Locking: Intrinsic locks

1 Introduction In previous posts we reviewed some of the main risks of sharing data between different threads (like atomicity and visibility). Additionally, we learnt 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…

Java Concurrency Tutorial

This Java concurrency tutorial consists of several posts that explain the main concepts of concurrency in Java. It starts with the basics with posts about the main concerns or risks of using non synchronised programs. This tutorial consists on two main areas: Basic concepts about how concurrency works This section…

Java Concurrency Tutorial – Thread-safe designs

1 Introduction 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 concurrency solutions. This will allow us to…

Java Concurrency Tutorial – Visibility between threads

1 Introduction When sharing an object’s state between different threads, other issues besides atomicity come into play. One of them is visibility between threads. 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…

Java Concurrency Tutorial – Atomicity and race conditions

1 Introduction Atomicity and race conditions 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…

Spring Integration 4.0: A complete XML-free example

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…

Spring Integration – Configure web service client timeout

1 Introduction With the support of Spring Integration, your application can invoke a web service by using an outbound web service gateway. The invocation is handled by this gateway. Hence, you just need to worry about building the request message and handling the response. However, with this approach it is…