aleph
Class RemoteFunction
java.lang.Object
|
+--aleph.RemoteFunction
- public abstract class RemoteFunction
- extends java.lang.Object
- implements java.io.Serializable
The base class for remote functions.
Remote functions are like remote threads, except that they return a value.
For example, a remote thread that returns a String could be written as follows.
class HelloThread extends RemoteFunction {
public Object run() {
return "Hello world!";
}
}
The following code creates a remote function, starts it at all PEs,
and collects all return values.
for (Enumeration e = PE.allPEs(); e.hasMoreElements(); )
thread.start((PE) e.nextElement(), join);
while(join.hasMoreElements())
System.out.println((String) join.nextElement());
- See Also:
- Serialized Form
|
Method Summary |
abstract java.lang.Object |
run()
This method does all the work. |
void |
start(PE pe)
Start the thread at the indicated PE. |
void |
start(PE pe,
Join join)
Start the thread at the indicated PE. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
RemoteFunction
public RemoteFunction()
run
public abstract java.lang.Object run()
- This method does all the work.
start
public void start(PE pe)
throws java.lang.IllegalThreadStateException
- Start the thread at the indicated PE.
- Parameters:
pe - The PE where the thread should execute.
start
public void start(PE pe,
Join join)
- Start the thread at the indicated PE.
- Parameters:
pe - The PE where the thread should execute.join - Stuff result object here.