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

temporalio / sdk-java / #284

23 Jul 2024 10:09PM UTC coverage: 77.304% (-0.06%) from 77.364%
#284

push

github

web-flow
Reintroduce slot supplier & add many tests (#2143)

593 of 752 new or added lines in 37 files covered. (78.86%)

22 existing lines in 10 files now uncovered.

19554 of 25295 relevant lines covered (77.3%)

0.77 hits per line

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

73.33
/temporal-sdk/src/main/java/io/temporal/worker/tuning/SlotReleaseReason.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.worker.tuning;
22

23
import io.temporal.common.Experimental;
24
import javax.annotation.Nullable;
25

26
@Experimental
27
public abstract class SlotReleaseReason {
28
  SlotReleaseReason() {}
1✔
29

30
  public static SlotReleaseReason taskComplete() {
31
    return new TaskComplete();
1✔
32
  }
33

34
  public static SlotReleaseReason willRetry() {
35
    return new WillRetry();
1✔
36
  }
37

38
  public static SlotReleaseReason neverUsed() {
39
    return new NeverUsed();
1✔
40
  }
41

42
  public static SlotReleaseReason error(Exception exception) {
43
    return new Error(exception);
1✔
44
  }
45

46
  public boolean isError() {
NEW
47
    return false;
×
48
  }
49

50
  /**
51
   * @return the exception that caused the slot to be released, if this is a reason of type {@link
52
   *     Error}.
53
   */
54
  public @Nullable Exception getException() {
NEW
55
    return null;
×
56
  }
57

58
  /** The slot was released because the task was completed (regardless of status). */
59
  public static class TaskComplete extends SlotReleaseReason {}
1✔
60

61
  /** The slot was released because the task will be retried. */
62
  public static class WillRetry extends SlotReleaseReason {}
1✔
63

64
  /** The slot was released because it was never needed. */
65
  public static class NeverUsed extends SlotReleaseReason {}
1✔
66

67
  /**
68
   * The slot was released because some error was encountered before the slot could be used to
69
   * actually process the task.
70
   */
71
  public static class Error extends SlotReleaseReason {
72
    private final Exception exception;
73

74
    private Error(Exception exception) {
1✔
75
      this.exception = exception;
1✔
76
    }
1✔
77

78
    @Override
79
    public boolean isError() {
NEW
80
      return true;
×
81
    }
82

83
    @Override
84
    public Exception getException() {
NEW
85
      return exception;
×
86
    }
87
  }
88
}
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

© 2026 Coveralls, Inc