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

temporalio / sdk-java / #103

pending completion
#103

push

github-actions

web-flow
Implement retry of local activities for over local retry threshold duration (#1542)

Issue #1261

244 of 244 new or added lines in 16 files covered. (100.0%)

16122 of 19841 relevant lines covered (81.26%)

0.81 hits per line

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

0.0
/temporal-sdk/src/main/java/io/temporal/internal/worker/CircularLongBuffer.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.internal.worker;
22

23
class CircularLongBuffer {
24

25
  private final long[] values_;
26

27
  public CircularLongBuffer(int size) {
×
28
    values_ = new long[size];
×
29
  }
×
30

31
  public CircularLongBuffer(long[] values) {
×
32
    values_ = values;
×
33
  }
×
34

35
  public void set(long i, long value) {
36
    values_[getArrayOffset(i)] = value;
×
37
  }
×
38

39
  public long get(long i) {
40
    return values_[getArrayOffset(i)];
×
41
  }
42

43
  public int size() {
44
    return values_.length;
×
45
  }
46

47
  public CircularLongBuffer copy(long index1, int length) {
48
    if (length == 0) {
×
49
      return new CircularLongBuffer(0);
×
50
    }
51
    int i1 = getArrayOffset(index1);
×
52
    int i2 = getArrayOffset(index1 + Math.min(length, values_.length));
×
53
    long[] result = new long[length];
×
54
    if (i1 < i2) {
×
55
      int l = i2 - i1;
×
56
      System.arraycopy(values_, i1, result, 0, l);
×
57
    } else {
×
58
      int tailLength = values_.length - i1;
×
59
      System.arraycopy(values_, i1, result, 0, tailLength);
×
60
      System.arraycopy(values_, 0, result, tailLength, i2);
×
61
    }
62
    return new CircularLongBuffer(result);
×
63
  }
64

65
  private int getArrayOffset(long index) {
66
    if (values_.length == 0) {
×
67
      throw new IllegalStateException("zero data size");
×
68
    }
69
    int result = (int) (index % values_.length);
×
70
    if (result < 0) {
×
71
      result = values_.length + result;
×
72
    }
73
    return result;
×
74
  }
75
}
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