You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/08/01 07:24:16 UTC
zest-java git commit: Added a bit of Javadocs.
Repository: zest-java
Updated Branches:
refs/heads/develop a35a4e37c -> 11a63a3ee
Added a bit of Javadocs.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/11a63a3e
Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/11a63a3e
Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/11a63a3e
Branch: refs/heads/develop
Commit: 11a63a3eedcabfd33c9bd3eab1e2567e4125e67f
Parents: a35a4e3
Author: Niclas Hedhman <ni...@hedhman.org>
Authored: Sat Aug 1 13:24:07 2015 +0800
Committer: Niclas Hedhman <ni...@hedhman.org>
Committed: Sat Aug 1 13:24:07 2015 +0800
----------------------------------------------------------------------
.../api/unitofwork/concern/UnitOfWorkRetry.java | 37 +++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-java/blob/11a63a3e/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java b/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java
index 71561fa..7334404 100644
--- a/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java
+++ b/core/api/src/main/java/org/apache/zest/api/unitofwork/concern/UnitOfWorkRetry.java
@@ -22,12 +22,14 @@ import java.lang.annotation.Documented;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
+import org.apache.zest.api.unitofwork.ConcurrentEntityModificationException;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
- * This annotation describes the retries that should occur in case of {@link org.apache.zest.api.unitofwork.ConcurrentEntityModificationException}
+ * This annotation describes the retries that should occur in case of
+ * {@link org.apache.zest.api.unitofwork.ConcurrentEntityModificationException}
* occurs.
*/
@Retention( RUNTIME )
@@ -36,9 +38,42 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Documented
public @interface UnitOfWorkRetry
{
+ /**
+ * Number of times that the UnitOfWork should be tried in total.
+ * The default value is 1, which means that the UnitOfWork will execute only one time. It is also the minimum
+ * value allowed.
+ *
+ * @return Number of times that the UnitOfWork will be executed. Must be 1 or higher. If a value of 0 or lower is
+ * given, the UnitOfWork is still executed one time.
+ */
int retries() default 1;
+ /**
+ * Number of milliseconds to wait before executing the second UnitOfOfWork.
+ * The default value is 0, which means that there is no delay and it is tried immediately.
+ *
+ * @return Number of milliseconds to wait before executing the second UnitOfOfWork.
+ */
long initialDelay() default 0;
+ /**
+ * Number of milliseconds to be added for each additional retry, beyond the second one.
+ * The default value is 10.
+ *
+ * The delay is defined as;
+ *
+ * <pre><code>
+ *
+ * Thread.sleep( initialDelay + retry * delayFactor );
+ * </code></pre>
+ * where retry will be 0 after first UnitOfWork had a {@link ConcurrentEntityModificationException} and is 1 after
+ * the first retry and so forth.
+ * <p/>
+ * So, with the {@code retries=4, initialDelay=5, delayFactor=20} the 3 delays between the UnitOfWorks will be
+ * {@code 5ms, 25ms, 45ms}
+ *
+ * @return The number of milliseconds per retry, except the first one, that should be added to the delay between
+ * tries.
+ */
long delayFactor() default 10;
}