assertj / assertj/assertj-swing
Pause object has a static ExecutorService that can't be shutdown
- Lingua principale
- Java
- Stelle
- 121
- Fork
- 52
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
`org.assertj.swing.timing.Pause` has an ExecutorService. It's static and cannot be closed. It means that we have non-daemon threads hanging in there and preventing the JVM to finish.
An example is
```java
public static void main(String[] args) throws Exception {
Pause.pause(new Condition("Cond") {
@Override
public boolean test() {
return true;
}
});
Field field = Pause.class.getDeclaredField("EXECUTOR_SERVICE");
field.setAccessible(true);
ExecutorService service = (ExecutorService) field.get(null);
service.shutdownNow();
}
```
Without the reflection code at the end, it won't exit for a while.
The easiest solution is to add a static `close()` method to shutdown the pool. But I think the best is to change the code to rely on the commonPool, e.g. `ForkJoinPool.commonPool().submit()` or a CompletableFuture.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Leggi org.assertj.swing.timing.Pause e traccia il ciclo di vita del suo EXECUTOR_SERVICE statico. Riproduci il problema con il metodo main di esempio, quindi scegli e valida un approccio di shutdown o common-pool; il lavoro è completato quando l’esempio può terminare senza reflection e senza thread non-daemon persistenti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100