forked from dapr/durabletask-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskOptions.java
More file actions
56 lines (48 loc) · 1.66 KB
/
TaskOptions.java
File metadata and controls
56 lines (48 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package io.dapr.durabletask;
/**
* Options that can be used to control the behavior of orchestrator and activity task execution.
*/
public final class TaskOptions {
private final RetryPolicy retryPolicy;
private final RetryHandler retryHandler;
private TaskOptions(RetryPolicy retryPolicy, RetryHandler retryHandler) {
this.retryPolicy = retryPolicy;
this.retryHandler = retryHandler;
}
/**
* Creates a new {@code TaskOptions} object from a {@link RetryPolicy}.
* @param retryPolicy the retry policy to use in the new {@code TaskOptions} object.
*/
public TaskOptions(RetryPolicy retryPolicy) {
this(retryPolicy, null);
}
/**
* Creates a new {@code TaskOptions} object from a {@link RetryHandler}.
* @param retryHandler the retry handler to use in the new {@code TaskOptions} object.
*/
public TaskOptions(RetryHandler retryHandler) {
this(null, retryHandler);
}
boolean hasRetryPolicy() {
return this.retryPolicy != null;
}
/**
* Gets the configured {@link RetryPolicy} value or {@code null} if none was configured.
* @return the configured retry policy
*/
public RetryPolicy getRetryPolicy() {
return this.retryPolicy;
}
boolean hasRetryHandler() {
return this.retryHandler != null;
}
/**
* Gets the configured {@link RetryHandler} value or {@code null} if none was configured.
* @return the configured retry handler.
*/
public RetryHandler getRetryHandler() {
return this.retryHandler;
}
}