• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #103

pending completion
#103

push

github-actions

web-flow
Implement retry of local activities for over local retry threshold duration (#1542)

Issue #1261

244 of 244 new or added lines in 16 files covered. (100.0%)

16122 of 19841 relevant lines covered (81.26%)

0.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/temporal-sdk/src/main/java/io/temporal/internal/statemachines/LocalActivityCallback.java
1
/*
2
 * Copyright (C) 2022 Temporal Technologies, Inc. All Rights Reserved.
3
 *
4
 * Copyright (C) 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
 *
6
 * Modifications copyright (C) 2017 Uber Technologies, Inc.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this material except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *   http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20

21
package io.temporal.internal.statemachines;
22

23
import io.temporal.api.common.v1.Payloads;
24
import io.temporal.api.failure.v1.Failure;
25
import io.temporal.workflow.Functions;
26
import java.time.Duration;
27
import java.util.Optional;
28
import javax.annotation.Nonnull;
29
import javax.annotation.Nullable;
30

31
@FunctionalInterface
32
public interface LocalActivityCallback
33
    extends Functions.Proc2<
34
        Optional<Payloads>, LocalActivityCallback.LocalActivityFailedException> {
35

36
  @Override
37
  void apply(Optional<Payloads> successOutput, LocalActivityFailedException exception);
38

39
  class LocalActivityFailedException extends RuntimeException {
40
    private final @Nonnull Failure failure;
41
    private final long originalScheduledTimestamp;
42
    private final int lastAttempt;
43
    /**
44
     * If this is not null, code that processes this exception will schedule a workflow timer to
45
     * continue retrying the execution
46
     */
47
    private final @Nullable Duration backoff;
48

49
    public LocalActivityFailedException(
50
        @Nonnull Failure failure,
51
        long originalScheduledTimestamp,
52
        int lastAttempt,
53
        @Nullable Duration backoff) {
1✔
54
      this.failure = failure;
1✔
55
      this.originalScheduledTimestamp = originalScheduledTimestamp;
1✔
56
      this.lastAttempt = lastAttempt;
1✔
57
      this.backoff = backoff;
1✔
58
    }
1✔
59

60
    @Nonnull
61
    public Failure getFailure() {
62
      return failure;
1✔
63
    }
64

65
    public long getOriginalScheduledTimestamp() {
66
      return originalScheduledTimestamp;
×
67
    }
68

69
    public int getLastAttempt() {
70
      return lastAttempt;
1✔
71
    }
72

73
    @Nullable
74
    public Duration getBackoff() {
75
      return backoff;
1✔
76
    }
77
  }
78
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc