O'Reilly logo

Java EE 8 High Performance by Romain Manni-Bucau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reactive programming and Java EE

Reactive programming lets your code be called instead of calling your code. You can visualize it as being event-based instead of procedural. Here is an example to compare both the styles:

public void processData(Data data) {    if (validator.isValid(data)) {        service.save(data);        return data;    }    throw new InvalidDataException();}

This is a very simple and common implementation of a business method where we call two services: validator and service. The first one will validate the data by checking whether it exists in the database, the values are in the expected ranges, and so on, while the second one will actually process the updates (a database, for instance).

The issue with this style is that the data validation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required