KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgap > distr > grid > JGAPAdmin


1 /*
2  * This file is part of JGAP.
3  *
4  * JGAP offers a dual license model containing the LGPL as well as the MPL.
5  *
6  * For licencing information please see the file license.txt included with JGAP
7  * or have a look at the top of class org.jgap.Chromosome which representatively
8  * includes the JGAP license policy applicable for any file delivered with JGAP.
9  */

10 package org.jgap.distr.grid;
11
12 import java.util.*;
13
14 import org.homedns.dade.jcgrid.*;
15 import org.homedns.dade.jcgrid.admin.*;
16
17 /**
18  * The admin instance can display status information about a running grid.
19  *
20  * @author Klaus Meffert
21  * @since 3.01
22  */

23 public class JGAPAdmin {
24   /** String containing the CVS revision. Read out via reflection!*/
25   private final static String JavaDoc CVS_REVISION = "$Revision: 1.3 $";
26
27   public JGAPAdmin()
28       throws Exception JavaDoc {
29     org.homedns.dade.jcgrid.admin.GridAdmin admin = new org.homedns.dade.jcgrid.
30         admin.GridAdmin();
31     admin.start();
32     while (true) {
33       List v = admin.getWorkerStats();
34       System.out.println("Number of workers: " + v.size());
35       Iterator it = v.iterator();
36       while (it.hasNext()) {
37         WorkerStats stat = (WorkerStats) it.next();
38         System.out.println(" " + stat.getName() + " / " + stat.getWorkingFor() +
39                            " / " + stat.getStatus() + " / " + stat.getUnitSec());
40       }
41       Thread.sleep(1000);
42     }
43   }
44
45   public static void main(String JavaDoc[] args)
46       throws Exception JavaDoc {
47     // Start admin instance.
48
// ---------------------
49
new JGAPAdmin();
50 // new guiJCGridAdminStatus(..);
51
}
52 }
53
Popular Tags