Skip to content

Commit e480fa7

Browse files
committed
Отложенная инициализация тред-пула
защита от повторной инициализации контекста
1 parent f1d67b1 commit e480fa7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 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.PostConstruct;
2930
import javax.annotation.PreDestroy;
3031
import java.util.concurrent.CompletableFuture;
3132
import java.util.concurrent.ExecutorService;
@@ -38,10 +39,15 @@
3839
@NoArgsConstructor
3940
public class SentryAspect {
4041

41-
private final ExecutorService executorService = Executors.newCachedThreadPool();
42+
private ExecutorService executorService;
43+
44+
@PostConstruct
45+
private void init() {
46+
executorService = Executors.newCachedThreadPool();
47+
}
4248

4349
@PreDestroy
44-
public void onDestroy() {
50+
private void onDestroy() {
4551
executorService.shutdown();
4652
}
4753

0 commit comments

Comments
 (0)