Author: cziegeler Date: Mon Mar 8 16:31:31 2010 New Revision: 920391 URL: http://svn.apache.org/viewvc?rev=920391&view=rev Log: Minor code cleanup
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java?rev=920391&r1=920390&r2=920391&view=diff ============================================================================== --- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java (original) +++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/TimedJobHandler.java Mon Mar 8 16:31:31 2010 @@ -214,7 +214,7 @@ if ( foundNode != null ) { try { foundNode.remove(); - parentNode.save(); + writerSession.save(); } catch (LockException le) { // if someone else has the lock this is fine } @@ -226,7 +226,7 @@ if ( foundNode != null ) { try { foundNode.remove(); - parentNode.save(); + writerSession.save(); } catch (LockException le) { // if someone else has the lock this is fine } @@ -333,7 +333,6 @@ // we create an own session here Session s = null; try { - s = this.createSession(); while ( iter.hasNext() ) { final javax.jcr.observation.Event event = iter.nextEvent(); if ( event.getType() == javax.jcr.observation.Event.PROPERTY_CHANGED @@ -346,6 +345,9 @@ // we are only interested in unlocks if ( "jcr:lockOwner".equals(propertyName) ) { try { + if ( s == null ) { + s = this.createSession(); + } final Node eventNode = (Node) s.getItem(nodePath); if ( !eventNode.isLocked() ) { try { @@ -490,7 +492,7 @@ if ( eventNode != null ) { try { eventNode.remove(); - parentNode.save(); + s.save(); } catch (RepositoryException re) { // we ignore the exception if removing fails ignoreException(re); @@ -761,10 +763,9 @@ // we should remove the node from the repository // if there is no node someone else was faster and we can ignore this if ( foundNode != null ) { - final Node parentNode = foundNode.getParent(); try { foundNode.remove(); - parentNode.save(); + writerSession.save(); } catch (LockException le) { // if someone else has the lock this is fine }