| Step 1 | Registering/unregistering application
First step in order to use JavaSymphony features is to register the application to the JS environment. The application should also un-register in the end. .... |
| Step 2 | Creating VAs
Some VAs are created. A number of corresponding node, registered with JS Shell should be available. Constraints (a set of conditions) can be used for the creation of the VAs. .... |
| Step 3 | Loading codebase
If we want to build remote objects we need to have the byte-code for the respective classes on the destination node. This is done using JSCodebase object. .... |
| Step 4 | Creating remote objects
The remote objects are implemented using JSObject class.An instance of this class is a handler to a remote object and can be also transmitted to other remote machines. We can specify the exact destination or not, constraints etc. We must provide class name and, if any, parameters for the constructor. RMI mechanism require remote objects classes to implements Serializable interface. ... |
| Step 5 | Invoke methods for remote object
Invoking methods for remote object is the main purpose of JavaSymphony application. With this invocations the programs are parallelized, data or code is transmitted across the network in order to build a distributed application. The method invocations are available with both remote JSObjects and shared memory SJSObjects. We have three types of method invocations descirbed below.
Object result; ResultHandle handle; // ***** synchronous method invocation for obj1 result = obj1.sinvoke("printText", parameters);
ResultHandle handle = obj.ainvoke("printText", parameters); .... // ***** after some time, we test if the result is available if(handle.isReady()) result = handle.getResult();
obj1.oinvoke("printText", parameters) |
| Finally | The full example
The full example has two parts: the main application which distributed objects on two computing nodes and invoke a method for these object, and the class for the remote object. The main application will put together all the things discuss about. /**** main application - just the processing method ****/ |