You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@batchee.apache.org by rs...@apache.org on 2015/12/07 22:48:44 UTC
incubator-batchee git commit: BATCHEE-84 retn BatchStatus in
Batches.waitForEnd
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 <rs...@apache.org>
Authored: Mon Dec 7 22:47:31 2015 +0100
Committer: Reinhard Sandtner <rs...@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();
}
}
Re: incubator-batchee git commit: BATCHEE-84 retn BatchStatus in Batches.waitForEnd
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Same as ConcurrentHasMap did in j8. Method lookup uses return type at
runtime.
Doesnt break src compilation but breaks code already compiled relying on it.
Le 8 déc. 2015 00:40, "Mark Struberg" <st...@yahoo.de> a écrit :
> 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 : <rs...@apache.org>
> > Date : 7 déc. 2015 23:48
> > Objet : incubator-batchee git commit: BATCHEE-84 retn BatchStatus in
> > Batches.waitForEnd
> > À : <co...@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 <rs...@apache.org>
> > Authored: Mon Dec 7 22:47:31 2015 +0100
> > Committer: Reinhard Sandtner <rs...@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();
> > }
> > }
>
>
Re: incubator-batchee git commit: BATCHEE-84 retn BatchStatus in Batches.waitForEnd
Posted by Mark Struberg <st...@yahoo.de>.
How does that break binary compat? ^^
> Am 07.12.2015 um 23:53 schrieb Romain Manni-Bucau <rm...@gmail.com>:
>
> Breaks binary compat. Can you add another method please?
> ---------- Message transféré ----------
> De : <rs...@apache.org>
> Date : 7 déc. 2015 23:48
> Objet : incubator-batchee git commit: BATCHEE-84 retn BatchStatus in
> Batches.waitForEnd
> À : <co...@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 <rs...@apache.org>
> Authored: Mon Dec 7 22:47:31 2015 +0100
> Committer: Reinhard Sandtner <rs...@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();
> }
> }
Fwd: incubator-batchee git commit: BATCHEE-84 retn BatchStatus in Batches.waitForEnd
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Breaks binary compat. Can you add another method please?
---------- Message transféré ----------
De : <rs...@apache.org>
Date : 7 déc. 2015 23:48
Objet : incubator-batchee git commit: BATCHEE-84 retn BatchStatus in
Batches.waitForEnd
À : <co...@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 <rs...@apache.org>
Authored: Mon Dec 7 22:47:31 2015 +0100
Committer: Reinhard Sandtner <rs...@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();
}
}