use of com.zimbra.cs.redolog.op.ModifyVolume in project zm-mailbox by Zimbra.
the class VolumeManager method update.
public Volume update(Volume update, boolean noRedo) throws ServiceException {
// Don't allow changing type of a current volume. The volume must be first made non-current before its type can
// be changed. A volume can be made non-current when another volume is made current for the volume type.
Volume vol = getVolume(update.getId());
if (update.getType() != vol.getType()) {
if (isCurrent(vol)) {
throw VolumeServiceException.CANNOT_CHANGE_TYPE_OF_CURRVOL(vol, update.getType());
}
}
ModifyVolume redoRecorder = null;
if (!noRedo) {
redoRecorder = new ModifyVolume(update);
redoRecorder.start(System.currentTimeMillis());
}
boolean success = false;
DbConnection conn = DbPool.getConnection();
try {
update = DbVolume.update(conn, update);
success = true;
if (!noRedo) {
redoRecorder.log();
}
return update;
} finally {
endTransaction(success, conn, redoRecorder);
if (success) {
synchronized (this) {
id2volume.put(update.getId(), update);
updateSweptDirectories();
if (isCurrent(vol)) {
updateCurrentVolumeRefs(update, update.getType());
}
}
}
}
}
Aggregations