/[xulu]/trunk/src/appl/parallel/spmd/AbstractSPMDTask.java
ViewVC logotype

Contents of /trunk/src/appl/parallel/spmd/AbstractSPMDTask.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Wed Feb 25 11:54:01 2009 UTC (15 years, 9 months ago) by mojays
File size: 2941 byte(s)
First Commit, corresponds to Revision 1008 of Wikisquare-SVN 
1 package appl.parallel.spmd;
2
3 import java.awt.Rectangle;
4
5 import schmitzm.data.WritableGrid;
6
7 /**
8 * This class may be used as the superclass to all {@link SPMDTask SPMDTasks}
9 * which should be executed on servers using the SPMD-paradigm. Subclasses
10 * should override the {@link #init()} and the {@link #run(Object...)} method,
11 * but never the {@link #initialize()} method. <br>
12 * <br>
13 * The Task provides access to the {@link SPMDClientInterface} and the
14 * {@link AdvancedSPMDClientInterface}. <br>
15 * <br>
16 * Notice that the {@link #init()} method is called exactly one time before
17 * execution for every instance (in multithreading there are multiple parallel
18 * instances of the same task, running on different parts of the resource).
19 *
20 * @author Dominik Appl
21 */
22 public abstract class AbstractSPMDTask implements SPMDTask {
23
24 protected transient AdvancedSPMDServerInterface serverController;
25
26 private boolean initalized = false;
27
28 /*
29 * (non-Javadoc)
30 *
31 * @see appl.parallel.spmd.SPMDTask#incomingUpdate(schmitzm.data.WritableGrid,
32 * java.awt.Rectangle)
33 */
34 public void incomingUpdate(WritableGrid outgoingGrid, Rectangle location) {
35 // TODO Auto-generated method stub
36
37 }
38
39 /*
40 * (non-Javadoc)
41 *
42 * @see appl.parallel.spmd.SPMDTask#outgoingUpdate(schmitzm.data.WritableGrid,
43 * java.awt.Rectangle)
44 */
45 public void outgoingUpdate(WritableGrid incomingGrid, Rectangle location) {
46 // TODO Auto-generated method stub
47
48 }
49
50 /*
51 * (non-Javadoc)
52 *
53 * @see appl.parallel.spmd.SPMDTask#run()
54 */
55 public abstract Object run(Object... parameters);
56
57 /*
58 * (non-Javadoc)
59 *
60 * @see appl.parallel.spmd.SPMDTask#getSPMDServerController()
61 */
62 public SPMDServerInterface getSPMDServerController() {
63 return serverController;
64 }
65
66 /*
67 * (non-Javadoc)
68 *
69 * @see appl.parallel.spmd.SPMDTask#getAdvancedSPMDServerController()
70 */
71 public AdvancedSPMDServerInterface getAdvancedSPMDServerController() {
72 return serverController;
73 }
74
75 /*
76 * (non-Javadoc)
77 *
78 * @see appl.parallel.spmd.SPMDTask#setSPMDServerController(appl.parallel.spmd.SPMDServerController)
79 */
80 public void setSPMDServerController(AdvancedSPMDServerInterface controller) {
81 this.serverController = controller;
82 }
83
84 /**
85 * Use this method to implement if you want t
86 */
87 public abstract void init();
88
89 /*
90 * (non-Javadoc)
91 *
92 * @see appl.parallel.spmd.SPMDTask#initialize()
93 */
94 public final void initialize() {
95 init();
96 initalized = true;
97 }
98
99 /*
100 * (non-Javadoc)
101 *
102 * @see appl.parallel.spmd.SPMDTask#isInitialized()
103 */
104 public boolean isInitialized() {
105 return initalized;
106 }
107
108 /**
109 * returns false. Override this method to enable multithreading
110 *
111 * @see appl.parallel.spmd.SPMDTask#supportsMultiThreading()
112 */
113 public boolean supportsMultiThreading() {
114 return false;
115 }
116
117 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26