les thread que je lancent fabriquent des images PNG a partir de JFreeChart.
Par contre, je pense que l'utilisation que je fait des threads est erronnée.
Voici le code d'un thread :
	
	| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 
 | public class ChartThread implements Runnable {
 
    private Map         params  =   null;
    private JFreeChart  chart   =   null;
 
    private boolean     isReady =   false;
 
 
    public ChartThread(Map  params) {
        this.params =   params;
    }
 
    public void run() {
        this.chart   =   ChartCustomFactory.getChart(params);
        isReady =   true;
    }
 
    public JFreeChart getChart()
    {
        while(!isReady){
            Thread.yield();
        }
 
        return this.chart;
    }
 
    /**
     * @return Returns the isReady.
     */
    public synchronized boolean isReady() {
        return this.isReady;
    } | 
 
Puis dans une autre classe j'instancie des ChartThread :
	
	ChartThread     t1  =   new ChartThread(chart_act_ges_ent.getMap());
 ensuite je l'ajoute a mon groupe
	
	groupeThread.addThread(t1, "chart_act_ges_ent");
 et apres je controle l'etat du groupe
	
	| 12
 3
 
 |  while(!groupeThread.isFinished()){
                Thread.yield();
        } | 
 
						
					
Partager