public void closeStorage(StorageData storageData) throws BusinessException, IOException, SerializationException {
  StorageData local=getLocalStorageDataObject(storageData);
synchronized (local) {
    if ((storageRecorder.isRecordingOn() || storageRecorder.isRecordingScheduled()) && Objects.equals(local,recorderStorageData)) {
      throw new BusinessException("Close the storage " + local + ".",StorageErrorCodeEnum.STORAGE_CAN_NOT_BE_CLOSED);
    }
 else     if (isStorageClosed(local)) {
      throw new BusinessException("Close the storage " + local + ".",StorageErrorCodeEnum.STORAGE_ALREADY_CLOSED);
    }
    StorageWriter writer=openedStoragesMap.get(local);
    if (writer != null) {
      writer.closeStorageWriter();
    }
    openedStoragesMap.remove(local);
    local.setDiskSize(getDiskSizeForStorage(local));
    local.markClosed();
    writeStorageDataToDisk(local);
  }
}

public void closeStorage ( StorageData storageData ) throws BusinessException , IOException , SerializationException { StorageData local = getLocalStorageDataObject ( storageData ) ; synchronized ( local ) { if ( ( storageRecorder . isRecordingOn ( ) || storageRecorder . isRecordingScheduled ( ) ) && Objects . equals ( local , recorderStorageData ) ) { throw new BusinessException ( "Close the storage " + local + "." , StorageErrorCodeEnum . STORAGE_CAN_NOT_BE_CLOSED ) ; } else if ( isStorageClosed ( local ) ) { throw new BusinessException ( "Close the storage " + local + "." , StorageErrorCodeEnum . STORAGE_ALREADY_CLOSED ) ; } StorageWriter writer = openedStoragesMap . get ( local ) ; if ( writer != null ) { writer . closeStorageWriter ( ) ; } openedStoragesMap . remove ( local ) ; local . setDiskSize ( getDiskSizeForStorage ( local ) ) ; local . markClosed ( ) ; writeStorageDataToDisk ( local ) ; } }
closes the storage if it is open .
