Search in sources :

Example 1 with SetCurrentVolume

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);
    }
}
Also used : DeleteVolume(com.zimbra.cs.redolog.op.DeleteVolume) ModifyVolume(com.zimbra.cs.redolog.op.ModifyVolume) DbVolume(com.zimbra.cs.db.DbVolume) CreateVolume(com.zimbra.cs.redolog.op.CreateVolume) SetCurrentVolume(com.zimbra.cs.redolog.op.SetCurrentVolume) SetCurrentVolume(com.zimbra.cs.redolog.op.SetCurrentVolume) DbConnection(com.zimbra.cs.db.DbPool.DbConnection)

Aggregations

DbConnection (com.zimbra.cs.db.DbPool.DbConnection)1 DbVolume (com.zimbra.cs.db.DbVolume)1 CreateVolume (com.zimbra.cs.redolog.op.CreateVolume)1 DeleteVolume (com.zimbra.cs.redolog.op.DeleteVolume)1 ModifyVolume (com.zimbra.cs.redolog.op.ModifyVolume)1 SetCurrentVolume (com.zimbra.cs.redolog.op.SetCurrentVolume)1