Skip to content

Commit 0d7b450

Browse files
llingllinggit
authored andcommitted
Add null pointer check for getCallerThreadPoolExecutor() #1265
1 parent 1970fe4 commit 0d7b450

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/ExecEndpointImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ private boolean processExec(CallContextImpl<I,O> callContext) {
192192
}
193193
break retry;
194194
case STOP_ALL_CALLS:
195-
getCallerThreadPoolExecutor().shutdown();
195+
if (getCallerThreadPoolExecutor() != null) {
196+
getCallerThreadPoolExecutor().shutdown();
197+
}
196198
break retry;
197199
}
198200
}

marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputEndpointImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ private void processInput(CallContextImpl<I,O> callContext, I[] inputBatch) {
233233
return;
234234

235235
case STOP_ALL_CALLS:
236-
getCallerThreadPoolExecutor().shutdown();
236+
if (getCallerThreadPoolExecutor() != null) {
237+
getCallerThreadPoolExecutor().shutdown();
238+
}
237239
}
238240
}
239241
}

marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/InputOutputEndpointImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ private void processInput(CallContextImpl<I,O> callContext, I[] inputBatch) {
236236
return;
237237

238238
case STOP_ALL_CALLS:
239-
getCallerThreadPoolExecutor().shutdown();
239+
if (getCallerThreadPoolExecutor() != null) {
240+
getCallerThreadPoolExecutor().shutdown();
241+
}
240242
}
241243
// executing in the application thread
242244
} else if (getCallContext() != null) {

marklogic-client-api/src/main/java/com/marklogic/client/dataservices/impl/OutputEndpointImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ private O[] getOutputStream(CallContextImpl<I,O> callContext) {
221221
return getEndpoint().getCaller().getOutputHandle().newArray(0);
222222

223223
case STOP_ALL_CALLS:
224-
getCallerThreadPoolExecutor().shutdown();
224+
if (getCallerThreadPoolExecutor() != null) {
225+
getCallerThreadPoolExecutor().shutdown();
226+
}
225227
}
226228
}
227229
}
@@ -289,7 +291,7 @@ public Boolean call() {
289291
bulkOutputCallerImpl.getCallContextQueue().put(callContext);
290292
submitTask(this);
291293
} else {
292-
if (aliveCallContextCount.decrementAndGet() == 0) {
294+
if (getCallerThreadPoolExecutor() != null && aliveCallContextCount.decrementAndGet() == 0) {
293295
getCallerThreadPoolExecutor().shutdown();
294296
}
295297
}

0 commit comments

Comments
 (0)