File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
server/src/main/java/org/elasticsearch/threadpool Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ public void execute(Runnable command) {
157157 return currentValue + 1 ;
158158 }
159159 });
160+ boolean executed = false ;
160161 try {
161162 delegate .execute (() -> {
162163 try {
@@ -167,11 +168,19 @@ public void execute(Runnable command) {
167168 tryShutdownDelegate ();
168169 }
169170 });
171+ executed = true ;
170172 } catch (RejectedExecutionException e ) {
173+ tryShutdownDelegate ();
171174 if (command == WORKER_PROBE ) {
172175 return ;
173176 }
174177 throw new EsRejectedExecutionException ("delegate rejected execution" , delegate .isShutdown ());
178+ } finally {
179+ if (executed == false ) {
180+ // Decrement outstanding
181+ runningTasks .decrementAndGet ();
182+ tryShutdownDelegate ();
183+ }
175184 }
176185 } catch (Exception e ) {
177186 if (wrappedRunnable instanceof AbstractRunnable abstractRunnable ) {
You can’t perform that action at this time.
0 commit comments