blob: ed3cd2cfba650ac79527e1ab78e575a1d1c7a94e [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>Retry</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
<link rel="shortcut icon" href="/img/microprofile-favicon.png">
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Retry";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/microprofile/faulttolerance/FallbackHandler.html" title="interface in org.eclipse.microprofile.faulttolerance"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/eclipse/microprofile/faulttolerance/Timeout.html" title="annotation in org.eclipse.microprofile.faulttolerance"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/microprofile/faulttolerance/Retry.html" target="_top">Frames</a></li>
<li><a href="Retry.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Required&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.eclipse.microprofile.faulttolerance</div>
<h2 title="Annotation Type Retry" class="title">Annotation Type Retry</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>@Inherited
@Documented
@Retention(value=RUNTIME)
@Target(value={METHOD,TYPE})
public @interface <span class="memberNameLabel">Retry</span></pre>
<div class="block">The retry annotation to define the number of retries. Any invalid config value causes
<a href="../../../../org/eclipse/microprofile/faulttolerance/exceptions/FaultToleranceDefinitionException.html" title="class in org.eclipse.microprofile.faulttolerance.exceptions"><code>FaultToleranceDefinitionException</code></a>.
<p>
When a method returns and the retry policy is present, the following rules are applied:
<ol>
<li>If the method returns normally (doesn't throw), the result is simply returned.
<li>Otherwise, if the thrown object is assignable to any value in the <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#abortOn--"><code>abortOn()</code></a> parameter, the thrown object
is rethrown.
<li>Otherwise, if the thrown object is assignable to any value in the <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#retryOn--"><code>retryOn()</code></a> parameter, the method call
is retried.
<li>Otherwise the thrown object is rethrown.
</ol>
If a method throws a <code>Throwable</code> which is not an <code>Error</code> or <code>Exception</code>, non-portable behavior
results.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#maxRetries--"><code>maxRetries()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#delay--"><code>delay()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#delayUnit--"><code>delayUnit()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#maxDuration--"><code>maxDuration()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#durationUnit--"><code>durationUnit()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#jitter--"><code>jitter()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#jitterDelayUnit--"><code>jitterDelayUnit()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#retryOn--"><code>retryOn()</code></a>,
<a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#abortOn--"><code>abortOn()</code></a></dd>
<dt><span class="simpleTagLabel">Examples (en):</span></dt>
<dd><a href="../../../../../../../tomee-9.0/examples/mp-faulttolerance-retry.html">mp-faulttolerance-retry</a>, <a href="../../../../../../../tomee-9.0/examples/mp-faulttolerance-fallback.html">mp-faulttolerance-fallback</a></dd>
<dt><span class="simpleTagLabel">Examples (es):</span></dt>
<dd><a href="../../../../../../../tomee-9.0/es/examples/mp-faulttolerance-retry.html">mp-faulttolerance-retry</a>, <a href="../../../../../../../tomee-9.0/es/examples/mp-faulttolerance-fallback.html">mp-faulttolerance-fallback</a></dd>
<dt><span class="simpleTagLabel">Examples (pt):</span></dt>
<dd><a href="../../../../../../../tomee-9.0/pt/examples/mp-faulttolerance-retry.html">mp-faulttolerance-retry</a>, <a href="../../../../../../../tomee-9.0/pt/examples/mp-faulttolerance-fallback.html">mp-faulttolerance-fallback</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.optional.element.summary">
<!-- -->
</a>
<h3>Optional Element Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Optional Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Class&lt;? extends java.lang.Throwable&gt;[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#abortOn--">abortOn</a></span></code>
<div class="block">The list of exception types that should <i>not</i> trigger a retry.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#delay--">delay</a></span></code>
<div class="block">The delay between retries.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.time.temporal.ChronoUnit</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#delayUnit--">delayUnit</a></span></code>
<div class="block">The unit for <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#delay--"><code>delay()</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.time.temporal.ChronoUnit</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#durationUnit--">durationUnit</a></span></code>
<div class="block">The duration unit for <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#maxDuration--"><code>maxDuration()</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#jitter--">jitter</a></span></code>
<div class="block">
Set the jitter to randomly vary retry delays for.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.time.temporal.ChronoUnit</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#jitterDelayUnit--">jitterDelayUnit</a></span></code>
<div class="block">The delay unit for <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#jitter--"><code>jitter()</code></a>.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#maxDuration--">maxDuration</a></span></code>
<div class="block">The max duration.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#maxRetries--">maxRetries</a></span></code>
<div class="block">The max number of the retries.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Class&lt;? extends java.lang.Throwable&gt;[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#retryOn--">retryOn</a></span></code>
<div class="block">The list of exception types that should trigger a retry.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.element.detail">
<!-- -->
</a>
<h3>Element Detail</h3>
<a name="maxRetries--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maxRetries</h4>
<pre>public abstract&nbsp;int&nbsp;maxRetries</pre>
<div class="block">The max number of the retries.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the max number of retries. -1 means retry forever. The value must be greater than or equal to -1.</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>3</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="delay--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>delay</h4>
<pre>public abstract&nbsp;long&nbsp;delay</pre>
<div class="block">The delay between retries. Defaults to 0. The value must be greater than or equal to 0.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the delay time</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>0L</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="delayUnit--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>delayUnit</h4>
<pre>public abstract&nbsp;java.time.temporal.ChronoUnit&nbsp;delayUnit</pre>
<div class="block">The unit for <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#delay--"><code>delay()</code></a>. Defaults to <code>ChronoUnit.MILLIS</code> if not set.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the delay unit</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>java.time.temporal.ChronoUnit.MILLIS</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="maxDuration--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>maxDuration</h4>
<pre>public abstract&nbsp;long&nbsp;maxDuration</pre>
<div class="block">The max duration. The max duration must be greater than the delay duration if set. 0 means not set.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the maximum duration to perform retries for</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>180000L</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="durationUnit--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>durationUnit</h4>
<pre>public abstract&nbsp;java.time.temporal.ChronoUnit&nbsp;durationUnit</pre>
<div class="block">The duration unit for <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#maxDuration--"><code>maxDuration()</code></a>. Defaults to <code>ChronoUnit.MILLIS</code> if not set.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the duration unit</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>java.time.temporal.ChronoUnit.MILLIS</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="jitter--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>jitter</h4>
<pre>public abstract&nbsp;long&nbsp;jitter</pre>
<div class="block"><p>
Set the jitter to randomly vary retry delays for. The value must be greater than or equals to 0. 0 means not set.
</p>
The effective delay will be [delay - jitter, delay + jitter] and always greater than or equal to 0. Negative
effective delays will be 0.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the jitter that randomly vary retry delays by. e.g. a jitter of 200 milliseconds will randomly add
between -200 and 200 milliseconds to each retry delay.</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>200L</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="jitterDelayUnit--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>jitterDelayUnit</h4>
<pre>public abstract&nbsp;java.time.temporal.ChronoUnit&nbsp;jitterDelayUnit</pre>
<div class="block">The delay unit for <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#jitter--"><code>jitter()</code></a>. Defaults to <code>ChronoUnit.MILLIS</code> if not set.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the jitter delay unit</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>java.time.temporal.ChronoUnit.MILLIS</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="retryOn--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>retryOn</h4>
<pre>public abstract&nbsp;java.lang.Class&lt;? extends java.lang.Throwable&gt;[]&nbsp;retryOn</pre>
<div class="block">The list of exception types that should trigger a retry.
<p>
Note that if a method throws a <code>Throwable</code> which is not an <code>Error</code> or <code>Exception</code>, non-portable
behavior results.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the exception types on which to retry</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>java.lang.Exception.class</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="abortOn--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>abortOn</h4>
<pre>public abstract&nbsp;java.lang.Class&lt;? extends java.lang.Throwable&gt;[]&nbsp;abortOn</pre>
<div class="block">The list of exception types that should <i>not</i> trigger a retry.
<p>
This list takes priority over the types listed in <a href="../../../../org/eclipse/microprofile/faulttolerance/Retry.html#retryOn--"><code>retryOn()</code></a>.
<p>
Note that if a method throws a <code>Throwable</code> which is not an <code>Error</code> or <code>Exception</code>, non-portable
behavior results.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the exception types on which to abort (not retry)</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>{}</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/eclipse/microprofile/faulttolerance/FallbackHandler.html" title="interface in org.eclipse.microprofile.faulttolerance"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/eclipse/microprofile/faulttolerance/Timeout.html" title="annotation in org.eclipse.microprofile.faulttolerance"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/eclipse/microprofile/faulttolerance/Retry.html" target="_top">Frames</a></li>
<li><a href="Retry.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Required&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>