Skip to content

Commit 687f7b1

Browse files
committed
Выключение executor service при остановке приложения
1 parent 24062b8 commit 687f7b1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.aspectj.lang.annotation.AfterThrowing;
2727
import org.aspectj.lang.annotation.Aspect;
2828

29+
import javax.annotation.PreDestroy;
2930
import java.util.concurrent.CompletableFuture;
3031
import java.util.concurrent.ExecutorService;
3132
import java.util.concurrent.Executors;
@@ -39,6 +40,11 @@ public class SentryAspect {
3940

4041
private final ExecutorService executorService = Executors.newCachedThreadPool();
4142

43+
@PreDestroy
44+
public void onDestroy() {
45+
executorService.shutdown();
46+
}
47+
4248
@AfterThrowing(value = "Pointcuts.isBSLDiagnostic() && Pointcuts.isGetDiagnosticsCall()", throwing = "ex")
4349
public void logThrowingBSLDiagnosticGetDiagnostics(Throwable ex) {
4450
CompletableFuture.runAsync(() -> Sentry.captureException(ex), executorService);

0 commit comments

Comments
 (0)