Skip to content

Commit 09522cb

Browse files
committed
fix sonarqube comments
1 parent ec0e0a2 commit 09522cb

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

client/src/main/java/io/split/client/impressions/ImpressionCounter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public class ImpressionCounter {
99

10-
private static final long TIME_INTERVAL_MS = 3600 * 1000;
10+
private static final long TIME_INTERVAL_MS = 3600L * 1000L;
1111

1212
private final ConcurrentHashMap<String, AtomicInteger> _counts;
1313

client/src/test/java/io/split/client/impressions/ImpressionObserverTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class ImpressionObserverTest {
2828
// We allow the cache implementation to have a 0.01% drift in size when elements change, given that it's internal
2929
// structure/references might vary, and the ObjectSizeCalculator is not 100% accurate
3030
private static final double SIZE_DELTA = 0.01;
31+
private final Random _rand = new Random();
3132

3233
private List<KeyImpression> generateKeyImpressions(long count) {
3334
ArrayList<KeyImpression> imps = new ArrayList<>();
@@ -100,13 +101,13 @@ public void testMemoryUsageStopsWhenCacheIsFull() throws Exception {
100101

101102

102103
private void caller(ImpressionObserver o, int count, ConcurrentLinkedQueue<KeyImpression> imps) {
103-
Random rand = new Random();
104+
104105
while (count-- > 0) {
105106
KeyImpression k = new KeyImpression();
106-
k.keyName = "key_" + rand.nextInt(100);
107-
k.feature = "feature_" + rand.nextInt(10);
108-
k.label = "label" + rand.nextInt(5);
109-
k.treatment = rand.nextBoolean() ? "on" : "off";
107+
k.keyName = "key_" + _rand.nextInt(100);
108+
k.feature = "feature_" + _rand.nextInt(10);
109+
k.label = "label" + _rand.nextInt(5);
110+
k.treatment = _rand.nextBoolean() ? "on" : "off";
110111
k.changeNumber = 1234567L;
111112
k.time = System.currentTimeMillis();
112113
k.pt = o.testAndSet(k);

0 commit comments

Comments
 (0)