Return-Path: Delivered-To: apmail-incubator-sling-commits-archive@locus.apache.org Received: (qmail 71853 invoked from network); 15 Aug 2008 07:33:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Aug 2008 07:33:24 -0000 Received: (qmail 8943 invoked by uid 500); 15 Aug 2008 07:33:23 -0000 Delivered-To: apmail-incubator-sling-commits-archive@incubator.apache.org Received: (qmail 8902 invoked by uid 500); 15 Aug 2008 07:33:23 -0000 Mailing-List: contact sling-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sling-dev@incubator.apache.org Delivered-To: mailing list sling-commits@incubator.apache.org Received: (qmail 8893 invoked by uid 99); 15 Aug 2008 07:33:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Aug 2008 00:33:23 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Aug 2008 07:32:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 614092388888; Fri, 15 Aug 2008 00:33:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r686165 - /incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java Date: Fri, 15 Aug 2008 07:33:02 -0000 To: sling-commits@incubator.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080815073303.614092388888@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Fri Aug 15 00:33:01 2008 New Revision: 686165 URL: http://svn.apache.org/viewvc?rev=686165&view=rev Log: SLING-614 : Persist retry count in repository Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java Modified: incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java URL: http://svn.apache.org/viewvc/incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java?rev=686165&r1=686164&r2=686165&view=diff ============================================================================== --- incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java (original) +++ incubator/sling/trunk/extensions/event/src/main/java/org/apache/sling/event/impl/JobEventHandler.java Fri Aug 15 00:33:01 2008 @@ -632,6 +632,26 @@ if ( jobId != null ) { eventNode.setProperty(EventHelper.NODE_PROPERTY_JOBID, jobId); } + final long retryCount = OsgiUtil.toLong(event.getProperty(EventUtil.PROPERTY_JOB_RETRY_COUNT), 0); + final long retries = OsgiUtil.toLong(event.getProperty(EventUtil.PROPERTY_JOB_RETRIES), this.maxJobRetries); + eventNode.setProperty(EventUtil.PROPERTY_JOB_RETRY_COUNT, retryCount); + eventNode.setProperty(EventUtil.PROPERTY_JOB_RETRIES, retries); + } + + /** + * @see org.apache.sling.event.impl.AbstractRepositoryEventHandler#addEventProperties(javax.jcr.Node, java.util.Dictionary) + */ + protected void addEventProperties(Node eventNode, + Dictionary properties) + throws RepositoryException { + super.addEventProperties(eventNode, properties); + // convert to integers (jcr only supports long) + if ( properties.get(EventUtil.PROPERTY_JOB_RETRIES) != null ) { + properties.put(EventUtil.PROPERTY_JOB_RETRIES, Integer.valueOf(properties.get(EventUtil.PROPERTY_JOB_RETRIES).toString())); + } + if ( properties.get(EventUtil.PROPERTY_JOB_RETRY_COUNT) != null ) { + properties.put(EventUtil.PROPERTY_JOB_RETRY_COUNT, Integer.valueOf(properties.get(EventUtil.PROPERTY_JOB_RETRY_COUNT).toString())); + } } /** @@ -756,19 +776,22 @@ retryCount = (Integer)job.getProperty(EventUtil.PROPERTY_JOB_RETRY_COUNT); } retryCount++; - if ( retryCount > retries ) { + if ( retries != -1 && retryCount > retries ) { reschedule = false; } - // update event with retry count - final Dictionary newProperties; - // create a new dictionary - newProperties = new Hashtable(); - final String[] names = job.getPropertyNames(); - for(int i=0; i newProperties; + // create a new dictionary + newProperties = new Hashtable(); + final String[] names = job.getPropertyNames(); + for(int i=0; i