Skip to content

Commit 97cc90c

Browse files
Clean up some code
1 parent 2d4cf66 commit 97cc90c

4 files changed

Lines changed: 49 additions & 9 deletions

File tree

temporal-sdk/src/main/java/io/temporal/internal/worker/ShutdownManager.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ public CompletableFuture<Void> waitForStickyQueueBalancer(
7171
balancer.disableNormalPoll();
7272
scheduledExecutorService.schedule(
7373
() -> {
74-
log.info("DRAIN TIMEOUT PASSED!!!!");
7574
future.complete(null);
7675
},
7776
timeout.toMillis(),
@@ -297,18 +296,12 @@ public SlotSupplierDelayShutdown(
297296

298297
@Override
299298
boolean isTerminated() {
300-
if (slotSupplier.getIssuedSlots() > 0) {
301-
log.info(
302-
"Wait for release of slots of {} is in progress {}",
303-
name,
304-
slotSupplier.getIssuedSlots());
305-
}
306299
return slotSupplier.getIssuedSlots() == 0;
307300
}
308301

309302
@Override
310303
void onSlowTermination() {
311-
log.info("Wait for release of slots of {} takes a long time", name);
304+
log.warn("Wait for release of slots of {} takes a long time", name);
312305
}
313306

314307
@Override

temporal-sdk/src/main/java/io/temporal/internal/worker/WorkflowWorker.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ public CompletableFuture<Void> shutdown(ShutdownManager shutdownManager, boolean
206206
pollerShutdown.thenCompose(
207207
ignore -> {
208208
if (!interruptTasks && stickyTaskQueueName != null) {
209-
log.info("Shutting down worker for sticky task queue: {}", stickyTaskQueueName);
210209
return shutdownManager.waitOnWorkerShutdownRequest(
211210
service
212211
.futureStub()

temporal-sdk/src/main/java/io/temporal/worker/tuning/PollerBehaviorAutoscaling.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,57 @@ public final class PollerBehaviorAutoscaling implements PollerBehavior {
1212
private final int maxConcurrentTaskPollers;
1313
private final int initialConcurrentTaskPollers;
1414

15+
/**
16+
* Creates a new PollerBehaviorAutoscaling with the specified parameters.
17+
*
18+
* @param minConcurrentTaskPollers Minimum number of concurrent task pollers.
19+
* @param maxConcurrentTaskPollers Maximum number of concurrent task pollers.
20+
* @param initialConcurrentTaskPollers Initial number of concurrent task pollers.
21+
*/
1522
public PollerBehaviorAutoscaling(
1623
int minConcurrentTaskPollers,
1724
int maxConcurrentTaskPollers,
1825
int initialConcurrentTaskPollers) {
26+
if (minConcurrentTaskPollers < 1) {
27+
throw new IllegalArgumentException("minConcurrentTaskPollers must be at least 1");
28+
}
29+
if (maxConcurrentTaskPollers < minConcurrentTaskPollers) {
30+
throw new IllegalArgumentException(
31+
"maxConcurrentTaskPollers must be greater than or equal to minConcurrentTaskPollers");
32+
}
33+
if (initialConcurrentTaskPollers < minConcurrentTaskPollers
34+
|| initialConcurrentTaskPollers > maxConcurrentTaskPollers) {
35+
throw new IllegalArgumentException(
36+
"initialConcurrentTaskPollers must be between minConcurrentTaskPollers and maxConcurrentTaskPollers");
37+
}
1938
this.minConcurrentTaskPollers = minConcurrentTaskPollers;
2039
this.maxConcurrentTaskPollers = maxConcurrentTaskPollers;
2140
this.initialConcurrentTaskPollers = initialConcurrentTaskPollers;
2241
}
2342

43+
/**
44+
* Gets the minimum number of concurrent task pollers.
45+
*
46+
* @return Minimum number of concurrent task pollers.
47+
*/
2448
public int getMinConcurrentTaskPollers() {
2549
return minConcurrentTaskPollers;
2650
}
2751

52+
/**
53+
* Gets the maximum number of concurrent task pollers.
54+
*
55+
* @return Maximum number of concurrent task pollers.
56+
*/
2857
public int getMaxConcurrentTaskPollers() {
2958
return maxConcurrentTaskPollers;
3059
}
3160

61+
/**
62+
* Gets the initial number of concurrent task pollers.
63+
*
64+
* @return Initial number of concurrent task pollers.
65+
*/
3266
public int getInitialMaxConcurrentTaskPollers() {
3367
return initialConcurrentTaskPollers;
3468
}

temporal-sdk/src/main/java/io/temporal/worker/tuning/PollerBehaviorSimpleMaximum.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,24 @@
77
public class PollerBehaviorSimpleMaximum implements PollerBehavior {
88
private final int maxConcurrentTaskPollers;
99

10+
/**
11+
* Creates a new PollerBehaviorSimpleMaximum with the specified maximum number of concurrent task
12+
* pollers.
13+
*
14+
* @param maxConcurrentTaskPollers Maximum number of concurrent task pollers.
15+
*/
1016
public PollerBehaviorSimpleMaximum(int maxConcurrentTaskPollers) {
17+
if (maxConcurrentTaskPollers < 1) {
18+
throw new IllegalArgumentException("maxConcurrentTaskPollers must be at least 1");
19+
}
1120
this.maxConcurrentTaskPollers = maxConcurrentTaskPollers;
1221
}
1322

23+
/**
24+
* Gets the maximum number of concurrent task pollers.
25+
*
26+
* @return Maximum number of concurrent task pollers.
27+
*/
1428
public int getMaxConcurrentTaskPollers() {
1529
return maxConcurrentTaskPollers;
1630
}

0 commit comments

Comments
 (0)