Fixes 2 bugs in the segmentation process

## Context
There were 2 bugs in the segmentation process : 
- When a client timeout happens very early in the segmentation process, a `NullPointerException` were thrown
- When `SegmentationJobRequest.getSegmentationIds()` returns `null`, a `NullPointerException` were thrown.
- The monitoring feature weren't always used the same way.

## Description
The 2 bugs are fixed.
The code has been refactored to use the new `TaskTemplate` class.