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.fitnessDistributed;
11:
12: import org.jgap.*;
13: import org.jgap.distr.grid.*;
14: import org.apache.log4j.*;
15:
16: /**
17: * Listener for feedback sent to the client. This is a simple sample
18: * implementation.
19: *
20: * @author Klaus Meffert
21: * @since 3.1
22: */
23: public class MyClientFeedback implements IClientFeedback {
24: /** String containing the CVS revision. Read out via reflection!*/
25: private final static String CVS_REVISION = "$Revision: 1.4 $";
26:
27: private final static String className = MyClientFeedback.class
28: .getName();
29:
30: private static Logger log = Logger.getLogger(className);
31:
32: public MyClientFeedback() {
33: }
34:
35: public void error(String msg, Exception ex) {
36: log.error("Error catched on client side: " + msg, ex);
37: }
38:
39: public void sendingFragmentRequest(JGAPRequest req) {
40: log.warn("Sending work request " + req.getRID());
41: }
42:
43: public void receivedFragmentResult(JGAPRequest req, JGAPResult res,
44: int idx) {
45: log.warn("Receiving work (index " + idx + "). First solution: "
46: + res.getPopulation().getChromosome(0));
47: }
48:
49: public void beginWork() {
50: log.warn("Client starts sending work requests");
51: }
52:
53: public void endWork() {
54: log.warn("Your request was processed completely");
55: }
56:
57: public void info(String a_msg) {
58: log.warn(a_msg);
59: }
60:
61: public void setProgressMaximum(int max) {
62: }
63:
64: public void setProgressMinimum(int min) {
65: }
66:
67: public void setProgressValue(int val) {
68: }
69:
70: public void setRenderingTime(MyRequest req, long dt) {
71: }
72:
73: public void completeFrame(int idx) {
74: log.warn("Client notified that unit " + idx + " is finished.");
75: }
76: }
|