Skip to content

Commit 0a5906e

Browse files
committed
remove debug
1 parent d493bec commit 0a5906e

File tree

4 files changed

+28
-54
lines changed

4 files changed

+28
-54
lines changed

src/main/java/io/nats/client/impl/NatsJetStreamSubscription.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,22 +151,10 @@ protected Message _nextUnmanagedNoWait(String expectedPullSubject) throws Interr
151151
}
152152
}
153153

154-
public static boolean INTERNAL_DEBUG__nextUnmanaged = false;
155-
156154
protected Message _nextUnmanaged(long timeoutNanos, String expectedPullSubject) throws InterruptedException {
157-
if (INTERNAL_DEBUG__nextUnmanaged) {
158-
System.out.println("_nextUnmanaged | "
159-
+ "timeoutNanos: " + timeoutNanos + "ns |"
160-
);
161-
}
162155
long timeLeftNanos = timeoutNanos;
163156
long start = NatsSystemClock.nanoTime();
164157
while (timeLeftNanos > 0) {
165-
if (INTERNAL_DEBUG__nextUnmanaged) {
166-
System.out.println("_nextUnmanaged | "
167-
+ "timeLeftNanos: " + timeLeftNanos + "ns |"
168-
);
169-
}
170158
Message msg = nextMessageInternal( Duration.ofNanos(timeLeftNanos) );
171159
if (msg == null) {
172160
return null; // normal timeout

src/test/java/io/nats/client/impl/KeyValueTests.java

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,9 +1847,9 @@ public void testLimitMarker() throws Exception {
18471847
public void testLimitMarkerAlso() throws Exception {
18481848
jsServer.run(TestBase::atLeast2_11_2, nc -> {
18491849
String bucket = bucket();
1850-
String key1 = "k1"; //key();
1851-
String key2 = "k2"; //key();
1852-
String key3 = "k3"; //key();
1850+
String key1 = key();
1851+
String key2 = key();
1852+
String key3 = key();
18531853

18541854
KeyValueManagement kvm = nc.keyValueManagement();
18551855
KeyValueConfiguration config = KeyValueConfiguration.builder()
@@ -1918,8 +1918,13 @@ public void endOfData() {
19181918
}
19191919
}
19201920
};
1921+
19211922
JetStreamSubscription sub = nc.jetStream().subscribe(null, d, rawHandler, true,
1922-
PushSubscribeOptions.builder().stream("KV_" + bucket).configuration(ConsumerConfiguration.builder().filterSubject(">").build()).build());
1923+
PushSubscribeOptions.builder()
1924+
.stream("KV_" + bucket)
1925+
.configuration(ConsumerConfiguration.builder().filterSubject(">")
1926+
.build())
1927+
.build());
19231928

19241929
kv.create(key1, dataBytes(), MessageTtl.seconds(2));
19251930
kv.create(key2, dataBytes());
@@ -1932,25 +1937,25 @@ public void endOfData() {
19321937
kv.purge(key2, MessageTtl.seconds(2));
19331938
kv.purge(key3);
19341939

1935-
if (before2_11_6()) {
1936-
sleep(8000); // longer than the message ttl plus the limit marker since double purge plus some extra
1937-
1938-
assertNull(kv.get(key1));
1939-
assertNull(kv.get(key2));
1940-
assertNull(kv.get(key3));
1941-
1942-
// create and put
1943-
assertEquals(3, wPuts.get());
1944-
assertEquals(4, wPurges.get()); // the 2 message ttl purge markers, the manual purge and the manual purge's purge.
1945-
assertEquals(0, wDels.get());
1946-
assertEquals(1, wEod.get());
1947-
1948-
assertEquals(7, rMessages.get());
1949-
assertEquals(2, rPurges.get());
1950-
assertEquals(2, rMaxAges.get());
1951-
assertEquals(2, rTtl2.get());
1952-
assertEquals(2, rTtl5.get());
1953-
}
1940+
// This section will have to be modified if there are changes
1941+
// to how purge markers are handled (double purge on ttl purge, fix for no purge of non-ttl purge)
1942+
sleep(8000); // longer than the message ttl plus the limit marker since double purge plus some extra
1943+
1944+
assertNull(kv.get(key1));
1945+
assertNull(kv.get(key2));
1946+
assertNull(kv.get(key3));
1947+
1948+
// create and put
1949+
assertEquals(3, wPuts.get());
1950+
assertEquals(4, wPurges.get()); // the 2 message ttl purge markers, the manual purge and the manual purge's purge.
1951+
assertEquals(0, wDels.get());
1952+
assertEquals(1, wEod.get());
1953+
1954+
assertEquals(7, rMessages.get());
1955+
assertEquals(2, rPurges.get());
1956+
assertEquals(2, rMaxAges.get());
1957+
assertEquals(2, rTtl2.get());
1958+
assertEquals(2, rTtl5.get());
19541959
});
19551960
}
19561961
}

src/test/java/io/nats/client/impl/SimplificationTests.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -935,9 +935,6 @@ private static void _testOrderedFetch(StreamContext sctx, int expectedStreamSeq,
935935

936936
@Test
937937
public void testOrderedBehaviorIterable() throws Exception {
938-
NatsJetStreamSubscription.INTERNAL_DEBUG__nextUnmanaged = true;
939-
System.out.println("testOrderedBehaviorIterable IN");
940-
941938
jsServer.run(TestBase::atLeast2_9_1, nc -> {
942939
// Setup
943940
JetStream js = nc.jetStream();
@@ -974,17 +971,9 @@ public void testOrderedBehaviorIterable() throws Exception {
974971
.consumerNamePrefix(prefix())
975972
.deliverPolicy(DeliverPolicy.ByStartSequence).startSequence(2));
976973
});
977-
System.out.println("testOrderedBehaviorIterable OUT");
978-
NatsJetStreamSubscription.INTERNAL_DEBUG__nextUnmanaged = false;
979974
}
980975

981976
private static void _testOrderedIterate(StreamContext sctx, int expectedStreamSeq, OrderedConsumerConfiguration occ) throws Exception {
982-
System.out.println("_testOrderedIterate | "
983-
+ "CS_FOR_SS_3: " + CS_FOR_SS_3 + " | "
984-
+ "seq: " + expectedStreamSeq + " | "
985-
+ "prefix: " + occ.getConsumerNamePrefix() + " | "
986-
+ "occ: " + occ.toJson()
987-
);
988977
OrderedConsumerContext occtx = sctx.createOrderedConsumer(occ);
989978
try (IterableConsumer icon = occtx.iterate()) {
990979
if (occ.getConsumerNamePrefix() != null) {

src/test/java/io/nats/client/utils/TestBase.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,6 @@ public static boolean atLeast2_11_2(ServerInfo si) {
165165
return si.isSameOrNewerThanVersion("2.11.2");
166166
}
167167

168-
public static boolean before2_11_6() {
169-
return before2_11_6(RUN_SERVER_INFO);
170-
}
171-
172-
public static boolean before2_11_6(ServerInfo si) {
173-
return si.isOlderThanVersion("2.11.6");
174-
}
175-
176168
public static void runInServer(InServerTest inServerTest) throws Exception {
177169
runInServer(false, false, null, null, inServerTest);
178170
}

0 commit comments

Comments
 (0)