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.mathProblemDistributed;
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: import org.jgap.distr.grid.gp.*;
17:
18: /**
19: * Convenience call to start both the server and a worker at once. Only for
20: * demonstration purposes. Normally, you would start the server and the
21: * worker(s) separately and possibly on different hosts!<p>
22: * This class can be used to start-up any JGAP grid, because the individual
23: * data is only kept with the JGAPClient! The JGAPClient distributes any data
24: * (including classes) necessary to the workers via the server.
25: *
26: * @author Klaus Meffert
27: * @since 3.2
28: */
29: public class ServerAndWorker {
30: /** String containing the CVS revision. Read out via reflection!*/
31: private final static String CVS_REVISION = "$Revision: 1.3 $";
32:
33: /**
34: * Convenience (demo) start of both the server and a worker.
35: *
36: * @param args might not work here in this simple example as distinct options
37: * between server and worker could lead to parsing errors.
38: *
39: * @throws Exception
40: *
41: * @author Klaus Meffert
42: * @since 3.2
43: */
44: public static void main(String[] args) throws Exception {
45: // Start server.
46: // ------------
47: new JGAPServer(args);
48: // Setup worker configuration.
49: // ---------------------------
50: Options options = new Options();
51: GridNodeWorkerConfig config = new GridNodeWorkerConfig();
52: CommandLine cmd = MainCmd.parseCommonOptions(options, config,
53: args);
54: // Start worker.
55: // -------------
56: new JGAPWorkersGP(config);
57: }
58: }
|