Skip to content

Commit ddf6bfd

Browse files
khetanshudalelane
authored andcommitted
Fixed jms open connection issue (#73). Signed-off-by: Khetanshu Chauhan [khetanshu.chauhan@gmail.com](mailto:khetanshu.chauhan@gmail.com)
1 parent 8505dfe commit ddf6bfd

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/main/java/com/ibm/eventstreams/connect/mqsource/MQSourceTask.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class MQSourceTask extends SourceTask {
3737
private CountDownLatch batchCompleteSignal = null; // Used to signal completion of a batch
3838
private AtomicInteger pollCycle = new AtomicInteger(1); // Incremented each time poll() is called
3939
private int lastCommitPollCycle = 0; // The value of pollCycle the last time commit() was called
40-
private AtomicBoolean receivingMessages = new AtomicBoolean(); // Whether currently receiving messages
4140
private AtomicBoolean stopNow = new AtomicBoolean(); // Whether stop has been requested
4241

4342
private JMSReader reader;
@@ -114,8 +113,6 @@ public MQSourceTask() {
114113
log.debug("Starting poll cycle {}", currentPollCycle);
115114

116115
try {
117-
receivingMessages.set(true);
118-
119116
if (!stopNow.get()) {
120117
log.info("Polling for records");
121118
SourceRecord src;
@@ -133,7 +130,6 @@ public MQSourceTask() {
133130
}
134131
}
135132
finally {
136-
receivingMessages.set(false);
137133
}
138134

139135
synchronized(this) {
@@ -219,16 +215,7 @@ public void commit() throws InterruptedException {
219215

220216
stopNow.set(true);
221217

222-
boolean willClose = false;
223-
224218
synchronized(this) {
225-
if (receivingMessages.get()) {
226-
log.debug("Will close connection");
227-
willClose = true;
228-
}
229-
}
230-
231-
if (willClose) {
232219
// Close the connection to MQ to clean up
233220
if (reader != null) {
234221
reader.close();

0 commit comments

Comments
 (0)