You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/docs/services/implementation.md
+143-6Lines changed: 143 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -154,12 +154,12 @@ There are multiple ways to define a retry policy for a Service:
154
154
155
155
- During the [configuration](/docs/components/workers#service-executor) of the Service Executor.
156
156
- Within the implementation code of the Service itself:
157
-
- By using the [`@Retry`](#using-retry-annotation) annotation
158
-
- By extending the [`WithRetry`](#using-with-retry-interface) interface
157
+
- By using the [`@Retry`](#retry-annotation) annotation
158
+
- By extending the [`WithRetry`](#with-retry-interface) interface
159
159
160
160
### `@Retry` Annotation
161
161
162
-
The `@Retry` annotation takes a class implementing the [`WithRetry`](#using-with-retry-interface) interface as parameter,
162
+
The `@Retry` annotation takes a class implementing the [`WithRetry`](#with-retry-interface) interface as parameter,
163
163
and can be used to define a retry policy on a specific Service (when used as a class annotation) or Task (when used as a method annotation):
164
164
165
165
{% codes %}
@@ -336,8 +336,8 @@ There are multiple ways to define an execution timeout for a Task:
336
336
337
337
- During the [configuration](/docs/services/executors#creating-a-service-executor) of the Service Executor.
338
338
- Within the implementation code of the Service itself:
339
-
- By using the [`@Timeout`](#using-timeout-annotation) annotation
340
-
- By extending the [`WithTimeout`](#using-with-timeout-interface) interface
339
+
- By using the [`@Timeout`](#timeout-annotation) annotation
340
+
- By extending the [`WithTimeout`](#with-timeout-interface) interface
341
341
342
342
343
343
{% callout type="warning" %}
@@ -348,7 +348,7 @@ When defined in the interface, a timeout has a different meaning. It represents
348
348
349
349
### `@Timeout` Annotation
350
350
351
-
This annotation has a class implementing [`WithTimeout`](#using-with-timeout-interface) as parameter.
351
+
This annotation has a class implementing [`WithTimeout`](#with-timeout-interface) as parameter.
352
352
353
353
It can be used as a method annotation to define a timeout on a specific task:
354
354
@@ -496,6 +496,143 @@ class MyServiceImpl : MyService, WithTimeout {
496
496
497
497
{% /codes %}
498
498
499
+
### Cooperative Canceling
500
+
501
+
{% callout type="warning" %}
502
+
503
+
When a task times out, the current execution is not automatically stopped. It's your responsability to cooperate with Infinitic to cancel the task execution
504
+
505
+
{% /callout %}
506
+
507
+
Infinitic provides a thread-local `hasTimedOut` property that can be used to check if the task has timed out:
Note: The current thread is automatically canceled when the timeout is reached. To provide time to do the necessary cleanup before the thread is canceled, you can specify a grace period in the `WithTimeout` interface.
0 commit comments