01: /*
02: * This file is part of JGAP.
03: *
04: * JGAP offers a dual license model containing the LGPL as well as the MPL.
05: *
06: * For licencing information please see the file license.txt included with JGAP
07: * or have a look at the top of class org.jgap.Chromosome which representatively
08: * includes the JGAP license policy applicable for any file delivered with JGAP.
09: */
10: package examples.grid.evolutionDistributed;
11:
12: import org.apache.commons.cli.*;
13: import org.homedns.dade.jcgrid.cmd.*;
14: import org.homedns.dade.jcgrid.worker.*;
15: import org.jgap.distr.grid.*;
16:
17: /**
18: * Convenience call to start both the server and a worker at once. Only for
19: * demonstration purposes. Normally, you would start the server and the
20: * worker(s) separately and possibly on different hosts!<p>
21: * This class can be used to start-up any JGAP grid, because the individual
22: * data is only kept with the JGAPClient! The JGAPClient distributes any data
23: * (including classes) necessary to the workers via the server.
24: *
25: * @author Klaus Meffert
26: * @since 3.2
27: */
28: public class ServerAndWorker {
29: /** String containing the CVS revision. Read out via reflection!*/
30: private final static String CVS_REVISION = "$Revision: 1.1 $";
31:
32: /**
33: * Convenience (demo) start of both the server and a worker.
34: *
35: * @param args might not work here in this simple example as distinct options
36: * between server and worker could lead to parsing errors.
37: *
38: * @throws Exception
39: *
40: * @author Klaus Meffert
41: * @since 3.2
42: */
43: public static void main(String[] args) throws Exception {
44: // Start server.
45: // ------------
46: new JGAPServer(args);
47: // Setup worker configuration.
48: // ---------------------------
49: Options options = new Options();
50: GridNodeWorkerConfig config = new GridNodeWorkerConfig();
51: CommandLine cmd = MainCmd.parseCommonOptions(options, config,
52: args);
53: // Start worker.
54: // -------------
55: new JGAPWorkers(config);
56: }
57: }
|