Bonjour,

J'ai un petit soucis avec une application java. Elle utilise spring pour initialiser simplement une liste de tests a executer sur des cartes. L'execution se passe bien mais l'application ne se termine jamais ...

Le fichier app-ctx-board-tests.xml definit une liste de tests a executer:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
	<!-- All the tests we have -->
	<bean id="dummyBoardTest" class="tests.DummyBoardTest" />
 
 
	<bean id="testRegistry" class="impl.TestRegistryImpl">
		<property name="boardTests">
			<list>
				<ref bean="dummyBoardTest" />
			</list>
		</property>
	</bean>
 
	<bean id="testRunner" class="impl.TestRunnerImpl">
		<property name="testRegistry" ref="testRegistry" />
	</bean>
</beans>
Le main recupere le bean, execute les tests pour chaque carte et
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
public class SmpAppCtxTest {
    public static void main(String[] args) {
 
        AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:<...>/app-ctx-board-tests.xml");
 
        TestRunner runner = (TestRunner) ctx.getBean("testRunner");  
        TestReport report = new TestReport();
        //ctx.registerShutdownHook();
 
        /* Ajoute des cartes et execute les routines dessus */
 
        ctx.close();        
    }
 
 
}
Jusque la tout va bien (enfin je crois...). A l'execution, le thread main est bien termine, tous mes objets sont bien finalises. Par contre, on voit bien que 3 threads restent actifs. Voici une copie de la pile:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
tests.SmpAppCtxTest at localhost:55013	
	Daemon Thread [AWT-Windows] (Running)	
	Thread [Timer-0] (Running)	
	Thread [DestroyJavaVM] (Running)
Le thread Timer-0 est demarre lorsque le ClassPathXmlApplicationContext est instancie, et c'est le thread qui pose probleme en empechant l'application de se terminer.

Savez-vous comment terminer l'application correctement? (exit est hors de question)

Merci
Jc