Please use this code template:
```
semaphone.acquire();
try {
  // Do something
} catch(XXXXXX) {
  // Exception management
} finally {
  semaphore.release();
}
```