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

temporalio / sdk-java / #244

10 Apr 2024 08:19PM UTC coverage: 77.465% (-0.08%) from 77.549%
#244

push

github

web-flow
Slot supplier interface & fixed-size implementation (#2014)

https://github.com/temporalio/proposals/blob/master/all-sdk/autotuning.md

286 of 388 new or added lines in 25 files covered. (73.71%)

3 existing lines in 3 files now uncovered.

19116 of 24677 relevant lines covered (77.46%)

0.77 hits per line

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

23.68
/temporal-sdk/src/main/java/io/temporal/worker/tuning/WorkflowSlotInfo.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.api.enums.v1.TaskQueueKind;
24
import io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueRequest;
25
import io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse;
26
import io.temporal.common.Experimental;
27
import java.util.Objects;
28
import javax.annotation.Nonnull;
29

30
/** Contains information about a slot that is being used to execute a workflow task. */
31
@Experimental
32
public class WorkflowSlotInfo extends SlotInfo {
33
  private final String workflowType;
34
  private final String taskQueue;
35
  private final String workflowId;
36
  private final String runId;
37
  private final String workerIdentity;
38
  private final String workerBuildId;
39
  private final boolean fromStickyQueue;
40

41
  /** Don't rely on this constructor. It is for internal use by the SDK. */
42
  public WorkflowSlotInfo(
43
      @Nonnull PollWorkflowTaskQueueResponse response,
44
      @Nonnull PollWorkflowTaskQueueRequest request) {
1✔
45
    this.workflowType = response.getWorkflowType().getName();
1✔
46
    this.taskQueue = request.getTaskQueue().getNormalName();
1✔
47
    this.workflowId = response.getWorkflowExecution().getWorkflowId();
1✔
48
    this.runId = response.getWorkflowExecution().getRunId();
1✔
49
    this.workerIdentity = request.getIdentity();
1✔
50
    this.workerBuildId = request.getWorkerVersionCapabilities().getBuildId();
1✔
51
    this.fromStickyQueue = request.getTaskQueue().getKind() == TaskQueueKind.TASK_QUEUE_KIND_STICKY;
1✔
52
  }
1✔
53

54
  /** Don't rely on this constructor. It is for internal use by the SDK. */
55
  public WorkflowSlotInfo(
56
      String workflowType,
57
      String taskQueue,
58
      String workflowId,
59
      String runId,
60
      String workerIdentity,
61
      String workerBuildId,
NEW
62
      boolean fromStickyQueue) {
×
NEW
63
    this.workflowType = workflowType;
×
NEW
64
    this.taskQueue = taskQueue;
×
NEW
65
    this.workflowId = workflowId;
×
NEW
66
    this.runId = runId;
×
NEW
67
    this.workerIdentity = workerIdentity;
×
NEW
68
    this.workerBuildId = workerBuildId;
×
NEW
69
    this.fromStickyQueue = fromStickyQueue;
×
NEW
70
  }
×
71

72
  public String getWorkflowType() {
NEW
73
    return workflowType;
×
74
  }
75

76
  public String getWorkflowId() {
NEW
77
    return workflowId;
×
78
  }
79

80
  public String getRunId() {
NEW
81
    return runId;
×
82
  }
83

84
  public String getTaskQueue() {
NEW
85
    return taskQueue;
×
86
  }
87

88
  public String getWorkerIdentity() {
NEW
89
    return workerIdentity;
×
90
  }
91

92
  public String getWorkerBuildId() {
NEW
93
    return workerBuildId;
×
94
  }
95

96
  public boolean isFromStickyQueue() {
NEW
97
    return fromStickyQueue;
×
98
  }
99

100
  @Override
101
  public boolean equals(Object o) {
NEW
102
    if (this == o) return true;
×
NEW
103
    if (o == null || getClass() != o.getClass()) return false;
×
NEW
104
    WorkflowSlotInfo that = (WorkflowSlotInfo) o;
×
NEW
105
    return fromStickyQueue == that.fromStickyQueue
×
NEW
106
        && Objects.equals(workflowType, that.workflowType)
×
NEW
107
        && Objects.equals(taskQueue, that.taskQueue)
×
NEW
108
        && Objects.equals(workflowId, that.workflowId)
×
NEW
109
        && Objects.equals(runId, that.runId)
×
NEW
110
        && Objects.equals(workerIdentity, that.workerIdentity)
×
NEW
111
        && Objects.equals(workerBuildId, that.workerBuildId);
×
112
  }
113

114
  @Override
115
  public int hashCode() {
NEW
116
    return Objects.hash(
×
NEW
117
        workflowType, taskQueue, workflowId, runId, workerIdentity, workerBuildId, fromStickyQueue);
×
118
  }
119

120
  @Override
121
  public String toString() {
NEW
122
    return "WorkflowSlotInfo{"
×
123
        + "workflowType='"
124
        + workflowType
125
        + '\''
126
        + ", taskQueue='"
127
        + taskQueue
128
        + '\''
129
        + ", workflowId='"
130
        + workflowId
131
        + '\''
132
        + ", runId='"
133
        + runId
134
        + '\''
135
        + ", workerIdentity='"
136
        + workerIdentity
137
        + '\''
138
        + ", workerBuildId='"
139
        + workerBuildId
140
        + '\''
141
        + ", fromStickyQueue="
142
        + fromStickyQueue
143
        + '}';
144
  }
145
}
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