pipeline blocking bugfix
This commit is contained in:
parent
b487fc832f
commit
bf693c3fbc
3 changed files with 2 additions and 26 deletions
|
|
@ -1,23 +0,0 @@
|
||||||
package ru.nbch.credit_tracker.service.task;
|
|
||||||
|
|
||||||
import java.util.concurrent.RejectedExecutionException;
|
|
||||||
import java.util.concurrent.RejectedExecutionHandler;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
|
|
||||||
public class BlockingRejectedExecutionHandler implements RejectedExecutionHandler {
|
|
||||||
|
|
||||||
public static RejectedExecutionHandler INSTANCE = new BlockingRejectedExecutionHandler();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void rejectedExecution(Runnable r, ThreadPoolExecutor exec) {
|
|
||||||
try {
|
|
||||||
if (exec.isShutdown()) {
|
|
||||||
throw new RejectedExecutionException("Executor is shut down");
|
|
||||||
}
|
|
||||||
exec.getQueue().put(r);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
throw new RejectedExecutionException("Interrupted while enqueueing task", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -41,7 +41,7 @@ public class Stage<X extends StagePayload, Z extends StagePayload> implements Ru
|
||||||
t.setName("pipe-handler-%s-%d".formatted(dispatcher.getClass().getSimpleName(), t.threadId()));
|
t.setName("pipe-handler-%s-%d".formatted(dispatcher.getClass().getSimpleName(), t.threadId()));
|
||||||
return t;
|
return t;
|
||||||
},
|
},
|
||||||
BlockingRejectedExecutionHandler.INSTANCE
|
new ThreadPoolExecutor.CallerRunsPolicy()
|
||||||
);
|
);
|
||||||
this.POISON = POISON;
|
this.POISON = POISON;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import ru.nbch.credit_tracker.mapper.signal.PhoneFidMapMapper;
|
||||||
import ru.nbch.credit_tracker.model.SubjectProfile;
|
import ru.nbch.credit_tracker.model.SubjectProfile;
|
||||||
import ru.nbch.credit_tracker.model.impl.SubjectPayload;
|
import ru.nbch.credit_tracker.model.impl.SubjectPayload;
|
||||||
import ru.nbch.credit_tracker.service.indic.FlagsService2;
|
import ru.nbch.credit_tracker.service.indic.FlagsService2;
|
||||||
import ru.nbch.credit_tracker.service.task.BlockingRejectedExecutionHandler;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
|
|
@ -49,7 +48,7 @@ public class FlagsEnricherV2 implements Consumer<SubjectPayload> {
|
||||||
t.setName("flags-enricher-%d".formatted(t.threadId()));
|
t.setName("flags-enricher-%d".formatted(t.threadId()));
|
||||||
return t;
|
return t;
|
||||||
},
|
},
|
||||||
BlockingRejectedExecutionHandler.INSTANCE
|
new ThreadPoolExecutor.CallerRunsPolicy()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue