/** {@inheritDoc} */
 @MethodLog
 public void stopRecording() throws StorageException {
   try {
     storageManager.stopRecording();
   } catch (Exception e) {
     throw new StorageException("Exception occurred trying to stop recording.", e);
   }
 }
 /**
  * Writes one data to the recording storage.
  *
  * @param dataToRecord Data to write.
  */
 public void record(DefaultData dataToRecord) {
   if (storageRecorder.isRecordingOn() && canWriteMore()) {
     storageRecorder.record(dataToRecord);
   } else if (storageRecorder.isRecordingOn() && !canWriteMore()) {
     try {
       stopRecording();
     } catch (Exception e) {
       log.warn(
           "Exception occurred trying to automatically stop the recording due to the hard disk space limitation warning.",
           e);
     }
   }
 }
 /**
  * Closes all opened storages. This method should only be called when the CMR shutdown hook is
  * activated to ensure that no data is lost.
  *
  * @throws SerializationException
  * @throws IOException
  */
 protected void closeAllStorages() {
   if (storageRecorder.isRecordingOn() || storageRecorder.isRecordingScheduled()) {
     try {
       stopRecording();
     } catch (Exception e) {
       log.warn("Recording storage could not be finalized during the CMR shut-down.", e);
     }
   }
   for (StorageData openedStorage : openedStoragesMap.keySet()) {
     try {
       this.closeStorage(openedStorage);
     } catch (Exception e) {
       log.warn(
           "Storage " + openedStorage + " could not be finalized during the CMR shut-down.", e);
     }
   }
 }