Skip to content

Commit 0b39a29

Browse files
committed
fix for stale metrics/suspend thread after river deletion
1 parent 1a6ff00 commit 0b39a29

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/main/java/org/xbib/elasticsearch/plugin/jdbc/RiverThread.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,8 @@ public P get() {
119119
for (RiverPipeline pipeline : pipelines) {
120120
pipeline.setInterrupted(true);
121121
}
122-
if (metricsThread != null) {
123-
logger.debug("interrupting metrics thread");
124-
metricsThread.interrupt();
125-
}
122+
closeMetricThread();
123+
closeSuspensionThread();
126124
Thread.currentThread().interrupt();
127125
logger.warn("interrupted");
128126
} catch (Throwable t) {
@@ -141,6 +139,11 @@ protected void afterPipelineExecutions() throws Exception {
141139
if (executor != null) {
142140
executor.shutdown();
143141
}
142+
closeMetricThread();
143+
closeSuspensionThread();
144+
}
145+
146+
private void closeMetricThread() {
144147
if (metricsThreadPoolExecutor != null) {
145148
logger.debug("shutting down metrics thread scheduler");
146149
metricsThreadPoolExecutor.shutdownNow();
@@ -149,6 +152,9 @@ protected void afterPipelineExecutions() throws Exception {
149152
if (metricsThread != null) {
150153
metricsThread.interrupt();
151154
}
155+
}
156+
157+
private void closeSuspensionThread() {
152158
if (suspensionThreadPoolExecutor != null) {
153159
logger.debug("shutting down suspension thread scheduler");
154160
suspensionThreadPoolExecutor.shutdownNow();

0 commit comments

Comments
 (0)