Skip to content

Commit 373c5f9

Browse files
committed
Remove internal ActivityExecutionDescription.info()
1 parent 0cc7209 commit 373c5f9

1 file changed

Lines changed: 37 additions & 45 deletions

File tree

temporal-sdk/src/main/java/io/temporal/client/ActivityExecutionDescription.java

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ public ActivityExecutionDescription(
5757
return s == null || s.isEmpty() ? null : s;
5858
}
5959

60-
private ActivityExecutionInfo info() {
61-
return info;
62-
}
63-
6460
/** The raw protobuf info returned by the server for this activity execution. */
6561
@Nonnull
6662
public ActivityExecutionInfo getRawInfo() {
@@ -69,7 +65,7 @@ public ActivityExecutionInfo getRawInfo() {
6965

7066
/** Current attempt number (starts at 1). */
7167
public int getAttempt() {
72-
return info().getAttempt();
68+
return info.getAttempt();
7369
}
7470

7571
/**
@@ -78,87 +74,83 @@ public int getAttempt() {
7874
*/
7975
@Nullable
8076
public String getCanceledReason() {
81-
String r = info().getCanceledReason();
77+
String r = info.getCanceledReason();
8278
return r.isEmpty() ? null : r;
8379
}
8480

8581
/** Current or next retry interval. {@code null} if no retries are configured or allowed. */
8682
@Nullable
8783
public Duration getCurrentRetryInterval() {
88-
return info().hasCurrentRetryInterval()
89-
? ProtobufTimeUtils.toJavaDuration(info().getCurrentRetryInterval())
84+
return info.hasCurrentRetryInterval()
85+
? ProtobufTimeUtils.toJavaDuration(info.getCurrentRetryInterval())
9086
: null;
9187
}
9288

9389
/** When the activity will time out (scheduled time + scheduleToCloseTimeout). */
9490
@Nullable
9591
public Instant getExpirationTime() {
96-
return info().hasExpirationTime()
97-
? ProtobufTimeUtils.toJavaInstant(info().getExpirationTime())
92+
return info.hasExpirationTime()
93+
? ProtobufTimeUtils.toJavaInstant(info.getExpirationTime())
9894
: null;
9995
}
10096

10197
/** Maximum allowed time between heartbeats. */
10298
@Nullable
10399
public Duration getHeartbeatTimeout() {
104-
return info().hasHeartbeatTimeout()
105-
? ProtobufTimeUtils.toJavaDuration(info().getHeartbeatTimeout())
100+
return info.hasHeartbeatTimeout()
101+
? ProtobufTimeUtils.toJavaDuration(info.getHeartbeatTimeout())
106102
: null;
107103
}
108104

109105
/** Time the last attempt completed (succeeded or failed). */
110106
@Nullable
111107
public Instant getLastAttemptCompleteTime() {
112-
return info().hasLastAttemptCompleteTime()
113-
? ProtobufTimeUtils.toJavaInstant(info().getLastAttemptCompleteTime())
108+
return info.hasLastAttemptCompleteTime()
109+
? ProtobufTimeUtils.toJavaInstant(info.getLastAttemptCompleteTime())
114110
: null;
115111
}
116112

117113
/** Time the last heartbeat was recorded. */
118114
@Nullable
119115
public Instant getLastHeartbeatTime() {
120-
return info().hasLastHeartbeatTime()
121-
? ProtobufTimeUtils.toJavaInstant(info().getLastHeartbeatTime())
116+
return info.hasLastHeartbeatTime()
117+
? ProtobufTimeUtils.toJavaInstant(info.getLastHeartbeatTime())
122118
: null;
123119
}
124120

125121
/** Time the last attempt was started. */
126122
@Nullable
127123
public Instant getLastStartedTime() {
128-
return info().hasLastStartedTime()
129-
? ProtobufTimeUtils.toJavaInstant(info().getLastStartedTime())
124+
return info.hasLastStartedTime()
125+
? ProtobufTimeUtils.toJavaInstant(info.getLastStartedTime())
130126
: null;
131127
}
132128

133129
/** Failure details from the last failed attempt. {@code null} if no failure has occurred. */
134130
@Nullable
135131
public Exception getLastFailure() {
136-
return info().hasLastFailure()
137-
? dataConverter.failureToException(info().getLastFailure())
138-
: null;
132+
return info.hasLastFailure() ? dataConverter.failureToException(info.getLastFailure()) : null;
139133
}
140134

141135
/** Identity of the worker that last processed this activity. */
142136
@Nullable
143137
public String getLastWorkerIdentity() {
144-
String w = info().getLastWorkerIdentity();
138+
String w = info.getLastWorkerIdentity();
145139
return w.isEmpty() ? null : w;
146140
}
147141

148142
/** Time when the next retry attempt will be scheduled. */
149143
@Nullable
150144
public Instant getNextAttemptScheduleTime() {
151-
return info().hasNextAttemptScheduleTime()
152-
? ProtobufTimeUtils.toJavaInstant(info().getNextAttemptScheduleTime())
145+
return info.hasNextAttemptScheduleTime()
146+
? ProtobufTimeUtils.toJavaInstant(info.getNextAttemptScheduleTime())
153147
: null;
154148
}
155149

156150
/** Retry policy for this activity. */
157151
@Nullable
158152
public RetryOptions getRetryOptions() {
159-
return info().hasRetryPolicy()
160-
? RetryOptionsUtils.toRetryOptions(info().getRetryPolicy())
161-
: null;
153+
return info.hasRetryPolicy() ? RetryOptionsUtils.toRetryOptions(info.getRetryPolicy()) : null;
162154
}
163155

164156
/**
@@ -167,36 +159,36 @@ public RetryOptions getRetryOptions() {
167159
*/
168160
@Nonnull
169161
public PendingActivityState getRunState() {
170-
return info().getRunState();
162+
return info.getRunState();
171163
}
172164

173165
/** Total time the caller is willing to wait for the activity to complete, including retries. */
174166
@Nullable
175167
public Duration getScheduleToCloseTimeout() {
176-
return info().hasScheduleToCloseTimeout()
177-
? ProtobufTimeUtils.toJavaDuration(info().getScheduleToCloseTimeout())
168+
return info.hasScheduleToCloseTimeout()
169+
? ProtobufTimeUtils.toJavaDuration(info.getScheduleToCloseTimeout())
178170
: null;
179171
}
180172

181173
/** Maximum time the task may wait in the task queue. */
182174
@Nullable
183175
public Duration getScheduleToStartTimeout() {
184-
return info().hasScheduleToStartTimeout()
185-
? ProtobufTimeUtils.toJavaDuration(info().getScheduleToStartTimeout())
176+
return info.hasScheduleToStartTimeout()
177+
? ProtobufTimeUtils.toJavaDuration(info.getScheduleToStartTimeout())
186178
: null;
187179
}
188180

189181
/** Maximum time for a single attempt. */
190182
@Nullable
191183
public Duration getStartToCloseTimeout() {
192-
return info().hasStartToCloseTimeout()
193-
? ProtobufTimeUtils.toJavaDuration(info().getStartToCloseTimeout())
184+
return info.hasStartToCloseTimeout()
185+
? ProtobufTimeUtils.toJavaDuration(info.getStartToCloseTimeout())
194186
: null;
195187
}
196188

197189
/** Whether heartbeat details were recorded for the last attempt. */
198190
public boolean hasHeartbeatDetails() {
199-
return info().hasHeartbeatDetails();
191+
return info.hasHeartbeatDetails();
200192
}
201193

202194
/**
@@ -217,12 +209,12 @@ public <V> Optional<V> getHeartbeatDetails(Class<V> valueType) {
217209
* @param genericType the generic type for deserialization; may equal {@code valueType}
218210
*/
219211
public <V> Optional<V> getHeartbeatDetails(Class<V> valueType, Type genericType) {
220-
if (!info().hasHeartbeatDetails()) {
212+
if (!info.hasHeartbeatDetails()) {
221213
return Optional.empty();
222214
}
223215
return Optional.ofNullable(
224216
dataConverter.fromPayloads(
225-
0, Optional.of(info().getHeartbeatDetails()), valueType, genericType));
217+
0, Optional.of(info.getHeartbeatDetails()), valueType, genericType));
226218
}
227219

228220
/**
@@ -231,20 +223,20 @@ public <V> Optional<V> getHeartbeatDetails(Class<V> valueType, Type genericType)
231223
*/
232224
@Nullable
233225
public WorkerDeploymentVersion getWorkerDeploymentVersion() {
234-
if (!info().hasLastDeploymentVersion()) {
226+
if (!info.hasLastDeploymentVersion()) {
235227
return null;
236228
}
237-
io.temporal.api.deployment.v1.WorkerDeploymentVersion proto = info().getLastDeploymentVersion();
229+
io.temporal.api.deployment.v1.WorkerDeploymentVersion proto = info.getLastDeploymentVersion();
238230
return new WorkerDeploymentVersion(proto.getDeploymentName(), proto.getBuildId());
239231
}
240232

241233
/** Priority hint for this activity. {@code null} if not set. */
242234
@Nullable
243235
public Priority getPriority() {
244-
if (!info().hasPriority()) {
236+
if (!info.hasPriority()) {
245237
return null;
246238
}
247-
return ProtoConverters.fromProto(info().getPriority());
239+
return ProtoConverters.fromProto(info.getPriority());
248240
}
249241

250242
/**
@@ -253,14 +245,14 @@ public Priority getPriority() {
253245
*/
254246
@Nullable
255247
public String getStaticSummary() {
256-
if (!info().hasUserMetadata() || !info().getUserMetadata().hasSummary()) {
248+
if (!info.hasUserMetadata() || !info.getUserMetadata().hasSummary()) {
257249
return null;
258250
}
259251
return dataConverter
260252
.withContext(
261253
new ActivitySerializationContext(
262254
namespace, null, null, getActivityType(), getTaskQueue(), false))
263-
.fromPayload(info().getUserMetadata().getSummary(), String.class, String.class);
255+
.fromPayload(info.getUserMetadata().getSummary(), String.class, String.class);
264256
}
265257

266258
/**
@@ -269,13 +261,13 @@ namespace, null, null, getActivityType(), getTaskQueue(), false))
269261
*/
270262
@Nullable
271263
public String getStaticDetails() {
272-
if (!info().hasUserMetadata() || !info().getUserMetadata().hasDetails()) {
264+
if (!info.hasUserMetadata() || !info.getUserMetadata().hasDetails()) {
273265
return null;
274266
}
275267
return dataConverter
276268
.withContext(
277269
new ActivitySerializationContext(
278270
namespace, null, null, getActivityType(), getTaskQueue(), false))
279-
.fromPayload(info().getUserMetadata().getDetails(), String.class, String.class);
271+
.fromPayload(info.getUserMetadata().getDetails(), String.class, String.class);
280272
}
281273
}

0 commit comments

Comments
 (0)