throw new InvalidItemStateException(msg);
}
checkLockable();
LockManager lockMgr = session.getLockManager();
synchronized (lockMgr) {
Lock lock = lockMgr.lock(this, isDeep, isSessionScoped);
boolean succeeded = false;
try {
// add properties to content
internalSetProperty(QName.JCR_LOCKOWNER,
InternalValue.create(getSession().getUserID()));
internalSetProperty(QName.JCR_LOCKISDEEP,
InternalValue.create(isDeep));
save();
succeeded = true;
} finally {
if (!succeeded) {
// failed to set lock meta-data content, cleanup
try {
lockMgr.unlock(this);
refresh(false);
} catch (RepositoryException re) {
// cleanup failed
log.error("error while cleaning up after failed lock attempt", re);
}