batchee-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: incubator-batchee git commit: BATCHEE-84 retn BatchStatus in Batches.waitForEnd
Date Mon, 07 Dec 2015 23:40:30 GMT
How does that break binary compat? ^^


> Am 07.12.2015 um 23:53 schrieb Romain Manni-Bucau <rmannibucau@gmail.com>:
> 
> Breaks binary compat. Can you add another method please?
> ---------- Message transféré ----------
> De : <rsandtner@apache.org>
> Date : 7 déc. 2015 23:48
> Objet : incubator-batchee git commit: BATCHEE-84 retn BatchStatus in
> Batches.waitForEnd
> À : <commits@batchee.incubator.apache.org>
> Cc :
> 
> Repository: incubator-batchee
> Updated Branches:
>  refs/heads/master 332e5ae04 -> 4d739e97f
> 
> 
> BATCHEE-84 retn BatchStatus in Batches.waitForEnd
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/incubator-batchee/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/incubator-batchee/commit/4d739e97
> Tree: http://git-wip-us.apache.org/repos/asf/incubator-batchee/tree/4d739e97
> Diff: http://git-wip-us.apache.org/repos/asf/incubator-batchee/diff/4d739e97
> 
> Branch: refs/heads/master
> Commit: 4d739e97f7c1963dfd770bdf528a56bfb68e05eb
> Parents: 332e5ae
> Author: Reinhard Sandtner <rsandtner@apache.org>
> Authored: Mon Dec 7 22:47:31 2015 +0100
> Committer: Reinhard Sandtner <rsandtner@apache.org>
> Committed: Mon Dec 7 22:47:31 2015 +0100
> 
> ----------------------------------------------------------------------
> .../java/org/apache/batchee/util/Batches.java   | 39 +++++++++++++-------
> 1 file changed, 26 insertions(+), 13 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/incubator-batchee/blob/4d739e97/jbatch/src/main/java/org/apache/batchee/util/Batches.java
> ----------------------------------------------------------------------
> diff --git a/jbatch/src/main/java/org/apache/batchee/util/Batches.java
> b/jbatch/src/main/java/org/apache/batchee/util/Batches.java
> index a7668c7..1482e8a 100644
> --- a/jbatch/src/main/java/org/apache/batchee/util/Batches.java
> +++ b/jbatch/src/main/java/org/apache/batchee/util/Batches.java
> @@ -31,24 +31,32 @@ public class Batches {
>         // no-op
>     }
> 
> -    public static void waitForEnd(final long id) {
> -        waitForEnd(BatchRuntime.getJobOperator(), id);
> +    public static BatchStatus waitForEnd(final long id) {
> +        return waitForEnd(BatchRuntime.getJobOperator(), id);
>     }
> 
> -    public static void waitForEnd(final JobOperator jobOperator, final
> long id) {
> +    public static BatchStatus waitForEnd(final JobOperator jobOperator,
> final long id) {
> +        BatchStatus batchStatus;
> +
>         if (JobOperatorImpl.class.isInstance(jobOperator)) {
>             JobOperatorImpl.class.cast(jobOperator).waitFor(id);
> -            return;
> -        }
> +            batchStatus = getBatchStatus(jobOperator, id);
> +        } else {
> 
> -        // else polling
> -        do {
> -            try {
> -                Thread.sleep(100);
> -            } catch (final InterruptedException e) {
> -                return;
> +            // else polling
> +            do {
> +                batchStatus = getBatchStatus(jobOperator, id);
> +
> +                try {
> +                    Thread.sleep(100);
> +                } catch (final InterruptedException e) {
> +                    return batchStatus;
> +                }
>             }
> -        } while (!isDone(jobOperator, id));
> +            while (!BATCH_END_STATUSES.contains(batchStatus));
> +        }
> +
> +        return batchStatus;
>     }
> 
>     public static boolean isDone(final BatchStatus status) {
> @@ -56,6 +64,11 @@ public class Batches {
>     }
> 
>     public static boolean isDone(final JobOperator jobOperator, final long
> id) {
> -        return
> BATCH_END_STATUSES.contains(jobOperator.getJobExecution(id).getBatchStatus());
> +        return isDone(getBatchStatus(jobOperator, id));
> +    }
> +
> +
> +    private static BatchStatus getBatchStatus(JobOperator jobOperator,
> long id) {
> +        return jobOperator.getJobExecution(id).getBatchStatus();
>     }
> }


Mime
View raw message