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

uber / cadence-java-client / 2641

07 Nov 2024 08:14PM UTC coverage: 80.761% (+0.5%) from 80.243%
2641

Pull #954

buildkite

shijiesheng
add test
Pull Request #954: Fix unhandled exceptions in WorkflowServiceTChannel

6 of 6 new or added lines in 1 file covered. (100.0%)

93 existing lines in 7 files now uncovered.

15662 of 19393 relevant lines covered (80.76%)

0.81 hits per line

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

0.0
/src/main/java/com/uber/cadence/internal/worker/PollerAutoScalerOptions.java
1
/*
2
 *  Modifications copyright (C) 2017 Uber Technologies, Inc.
3
 *
4
 *  Licensed under the Apache License, Version 2.0 (the "License"). You may not
5
 *  use this file except in compliance with the License. A copy of the License is
6
 *  located at
7
 *
8
 *  http://aws.amazon.com/apache2.0
9
 *
10
 *  or in the "license" file accompanying this file. This file is distributed on
11
 *  an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
 *  express or implied. See the License for the specific language governing
13
 *  permissions and limitations under the License.
14
 */
15

16
package com.uber.cadence.internal.worker;
17

18
import java.time.Duration;
19
import java.util.Objects;
20

21
public class PollerAutoScalerOptions {
22

23
  private Duration pollerScalingInterval;
24
  private int minConcurrentPollers;
25
  private float targetPollerUtilisation;
26

27
  private PollerAutoScalerOptions() {}
28

29
  public static class Builder {
30

UNCOV
31
    private Duration pollerScalingInterval = Duration.ofMinutes(1);
×
UNCOV
32
    private int minConcurrentPollers = 1;
×
UNCOV
33
    private float targetPollerUtilisation = 0.6f;
×
34

UNCOV
35
    private Builder() {}
×
36

37
    public static Builder newBuilder() {
UNCOV
38
      return new Builder();
×
39
    }
40

41
    public Builder setPollerScalingInterval(Duration duration) {
UNCOV
42
      this.pollerScalingInterval = duration;
×
UNCOV
43
      return this;
×
44
    }
45

46
    public Builder setMinConcurrentPollers(int minConcurrentPollers) {
UNCOV
47
      this.minConcurrentPollers = minConcurrentPollers;
×
UNCOV
48
      return this;
×
49
    }
50

51
    public Builder setTargetPollerUtilisation(float targetPollerUtilisation) {
UNCOV
52
      this.targetPollerUtilisation = targetPollerUtilisation;
×
UNCOV
53
      return this;
×
54
    }
55

56
    public PollerAutoScalerOptions build() {
UNCOV
57
      PollerAutoScalerOptions pollerAutoScalerOptions = new PollerAutoScalerOptions();
×
UNCOV
58
      pollerAutoScalerOptions.pollerScalingInterval = this.pollerScalingInterval;
×
UNCOV
59
      pollerAutoScalerOptions.minConcurrentPollers = this.minConcurrentPollers;
×
UNCOV
60
      pollerAutoScalerOptions.targetPollerUtilisation = this.targetPollerUtilisation;
×
UNCOV
61
      return pollerAutoScalerOptions;
×
62
    }
63
  }
64

65
  public Duration getPollerScalingInterval() {
66
    return pollerScalingInterval;
×
67
  }
68

69
  public int getMinConcurrentPollers() {
70
    return minConcurrentPollers;
×
71
  }
72

73
  public float getTargetPollerUtilisation() {
74
    return targetPollerUtilisation;
×
75
  }
76

77
  @Override
78
  public boolean equals(Object o) {
UNCOV
79
    if (this == o) return true;
×
80
    if (o == null || getClass() != o.getClass()) return false;
×
81
    PollerAutoScalerOptions that = (PollerAutoScalerOptions) o;
×
82
    return minConcurrentPollers == that.minConcurrentPollers
×
83
        && Float.compare(that.targetPollerUtilisation, targetPollerUtilisation) == 0
×
84
        && Objects.equals(pollerScalingInterval, that.pollerScalingInterval);
×
85
  }
86

87
  @Override
88
  public int hashCode() {
89
    return Objects.hash(pollerScalingInterval, minConcurrentPollers, targetPollerUtilisation);
×
90
  }
91

92
  @Override
93
  public String toString() {
94
    return "PollerAutoScalerOptions{"
×
95
        + "pollerScalingInterval="
96
        + pollerScalingInterval
97
        + ", minConcurrentPollers="
98
        + minConcurrentPollers
99
        + ", targetPollerUtilisation="
100
        + targetPollerUtilisation
101
        + '}';
102
  }
103
}
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