You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2008/02/13 16:25:21 UTC
svn commit: r627465 -
/incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
Author: cziegeler
Date: Wed Feb 13 07:25:18 2008
New Revision: 627465
URL: http://svn.apache.org/viewvc?rev=627465&view=rev
Log:
Use same session for unlocking and unlock node before removing.
Modified:
incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
Modified: incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java?rev=627465&r1=627464&r2=627465&view=diff
==============================================================================
--- incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java (original)
+++ incubator/sling/trunk/sling/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java Wed Feb 13 07:25:18 2008
@@ -633,15 +633,19 @@
}
}
final boolean parallelProcessing = job.getProperty(EventUtil.PROPERTY_JOB_PARALLEL) != null;
- Session s = null;
+ // we have to use the same session for unlocking that we used for locking!
+ // TODO - we have to bring the session into the same thread!
try {
- s = this.createSession();
- // remove lock token from shared session and add it to current session
- this.backgroundSession.removeLockToken(lockToken);
- s.addLockToken(lockToken);
- final Node eventNode = (Node) s.getItem(eventNodePath);
+ final Node eventNode = (Node) this.backgroundSession.getItem(eventNodePath);
try {
if ( !reschedule ) {
+ // unlock node
+ try {
+ eventNode.unlock();
+ } catch (RepositoryException e) {
+ // if unlock fails, we silently ignore this
+ this.ignoreException(e);
+ }
// remove node from repository
final Node parentNode = eventNode.getParent();
eventNode.remove();
@@ -714,10 +718,6 @@
} catch (RepositoryException re) {
this.logger.error("Unable to create new session.", re);
return false;
- } finally {
- if ( s != null ) {
- s.logout();
- }
}
}