use of com.zimbra.cs.redolog.op.SetCurrentVolume in project zm-mailbox by Zimbra.
the class VolumeManager method setCurrentVolume.
/**
* Set the current volume of given type. Pass ID_NONE for id to unset.
*/
public void setCurrentVolume(short type, short id, boolean noRedo) throws ServiceException {
SetCurrentVolume redoRecorder = null;
if (!noRedo) {
redoRecorder = new SetCurrentVolume(type, id);
redoRecorder.start(System.currentTimeMillis());
}
Volume vol = null;
if (id != Volume.ID_NONE) {
vol = getVolume(id);
if (vol.getType() != type) {
throw VolumeServiceException.WRONG_TYPE_CURRVOL(id, type);
}
}
boolean success = false;
DbConnection conn = DbPool.getConnection();
try {
DbVolume.updateCurrentVolume(conn, type, id);
updateCurrentVolumeRefs(vol, type);
success = true;
if (!noRedo) {
redoRecorder.log();
}
} finally {
endTransaction(success, conn, redoRecorder);
}
}
Aggregations