Skip to content

Commit 8dead53

Browse files
committed
Self review
1 parent 1b17096 commit 8dead53

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void pendingUpdated() {}
6767

6868
@Override
6969
public void heartbeatError() {
70-
finishAndShutdownSub();
70+
fullClose();
7171
}
7272

7373
@Override
@@ -85,7 +85,7 @@ public Message nextMessage() throws InterruptedException, JetStreamStatusChecked
8585
if (m == null) {
8686
// if there are no messages in the internal cache AND there are no more pending,
8787
// they all have been read and we can go ahead and finish
88-
finishAndShutdownSub();
88+
fullClose();
8989
}
9090
return m;
9191
}
@@ -103,15 +103,15 @@ public Message nextMessage() throws InterruptedException, JetStreamStatusChecked
103103
Message m = sub._nextUnmanagedNoWait(pullSubject);
104104
if (m == null) {
105105
// no message and no time left, go ahead and finish
106-
finishAndShutdownSub();
106+
fullClose();
107107
}
108108
return m;
109109
}
110110

111111
Message m = sub._nextUnmanaged(timeLeftNanos, pullSubject);
112112
if (m == null && isNoWaitNoExpires) {
113113
// no message and no wait, go ahead and finish
114-
finishAndShutdownSub();
114+
fullClose();
115115
}
116116
return m;
117117
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class NatsMessageConsumer extends NatsMessageConsumerBase implements PullManager
5353
public void heartbeatError() {
5454
try {
5555
if (stopped.get()) {
56-
finishAndShutdownSub();
56+
fullClose();
5757
}
5858
else {
5959
shutdownSub();
@@ -92,10 +92,10 @@ private void setupHbAlarmToTrigger() {
9292
public void pendingUpdated() {
9393
if (stopped.get()) {
9494
if (pmm.noMorePending()) {
95-
finishAndShutdownSub();
95+
fullClose();
9696
}
9797
}
98-
else if ((pmm.pendingMessages <= thresholdMessages || (pmm.trackingBytes && pmm.pendingBytes <= thresholdBytes)))
98+
else if (pmm.pendingMessages <= thresholdMessages || (pmm.trackingBytes && pmm.pendingBytes <= thresholdBytes))
9999
{
100100
repull();
101101
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public void close() throws Exception {
105105
shutdownSub();
106106
}
107107

108-
protected void finishAndShutdownSub() {
108+
protected void fullClose() {
109109
stopped.set(true);
110110
finished.set(true);
111111
shutdownSub();

0 commit comments

Comments
 (0)