Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0408110DA7 for ; Fri, 6 Sep 2013 08:36:13 +0000 (UTC) Received: (qmail 36579 invoked by uid 500); 6 Sep 2013 08:36:12 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 36518 invoked by uid 500); 6 Sep 2013 08:36:10 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 36507 invoked by uid 99); 6 Sep 2013 08:36:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2013 08:36:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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, 06 Sep 2013 08:36:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E06AD2388900; Fri, 6 Sep 2013 08:35:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1520511 - /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java Date: Fri, 06 Sep 2013 08:35:47 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130906083547.E06AD2388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: cziegeler Date: Fri Sep 6 08:35:47 2013 New Revision: 1520511 URL: http://svn.apache.org/r1520511 Log: SLING-3028 : Support for progress tracking of jobs - prototype of an API Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java?rev=1520511&r1=1520510&r2=1520511&view=diff ============================================================================== --- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java (original) +++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/consumer/JobExecutionContext.java Fri Sep 6 08:35:47 2013 @@ -20,9 +20,6 @@ package org.apache.sling.event.jobs.cons import aQute.bnd.annotation.ProviderType; - - - /** * * @since 1.1 @@ -30,22 +27,53 @@ import aQute.bnd.annotation.ProviderType @ProviderType public interface JobExecutionContext { - interface AsyncHandler { - - void failed(); - - void ok(); - - void cancel(); - } - - AsyncHandler getAsyncHandler(); - - void log(final String message); - - void start(final int steps); - - void start(final int steps, final long eta); - + /** + * Report an async result. + * @throws IllegalStateException If the job is not processed asynchronously + */ + void asyncProcessingFinished(final JobStatus status); + + /** + * Indicate that the job executor is able to report the progress + * by providing a step count. + * This method should only be called once, consecutive calls + * or a call to {@link #startProgress(long)} have no effect. + * @param steps Number of total steps or -1 if the number of + * steps is unknown. + */ + void startProgress(final int steps); + + /** + * Indicate that the job executor is able to report the progress + * by providing an ETA. + * This method should only be called once, consecutive calls + * or a call to {@link #startProgress(int)} have no effect. + * @param eta Number of seconds the process should take or + * -1 of it's not known now. + */ + void startProgress(final long eta); + + /** + * Update the progress to the current finished step. + * This method has only effect if {@link #startProgress(int)} + * has been called first. + * @param step The current step. + */ void setProgress(final int step); + + /** + * Update the progress to the new ETA. + * This method has only effect if {@link #startProgress(long)} + * has been called first. + * @param eta The new ETA + */ + void update(final long eta); + + /** + * Log a message. + * The message might contain place holders for additional arguments. + * @param message A message + * @param args Additional arguments + */ + void log(final String message, final Object...args); }