jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bahl Christian <christian.b...@gwvs.de>
Subject Unlocking nodes locked by another Session
Date Thu, 09 Jul 2009 13:18:49 GMT
Hi,

is it possible to unlock a Node locked by a different session. I don´t know exactly which
session.

If not, how can i be sure that a node will be unlocked when a functions throws an exception.


I´ve programmed an example of editing an article:

	try {
		node = ocm.getSession().getNodeByUUID(docList.get(index).getUuid());
		doc = (JCRDokumentContent) ocm.getObjectByUuid(docList.get(index).getUuid());

		doc.setTempContent(false);
		ocm.checkout(doc.getPath());
		ocm.update(doc);
		ocm.save();
		ocm.checkin(doc.getPath());
	}
	catch (ObjectContentManagerException e) {
		logger.error(e.getLocalizedMessage(), e);
	}
	finally {
		if (doc != null && StringUtils.hasText(doc.getPath())) { 
			JCRUtility.removeExistingLock(doc.getPath(), ocm, node.getLock().getLockToken());
		}
	}

JCRUtility.removeExistingLock  - Function:

	if (ocm.objectExists(path)) {
		if (ocm.isLocked(path)) {
			ocm.unlock(path, lockToken);
		}
	}

Is this a good solution to avoid unresolved locks?

Thanks 
Christian


Mime
View raw message