2 bug fixes in segmentation process and monitoring refactoring

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