Information Technology Reference
In-Depth Information
specific requirement of having their parameters and return values implement the
java.io.Serializable interface.
Using the list of classes and associated matched methods, one or more in-
terfaces that extend the java.rmi.Remote interface are generated. Each method
that is added to the interface is declared to throw the java.rmi.RemoteException
exception.
5.4.3
RMI Server Generation Phase
Each matching method defined by pointcut statements is checked to ensure they
are defined as public, non-transient and non-native. If any of these checks fail, a
compiler error is generated or, if the checks are successful, the class is altered to
implement the generated interface described in Section 5.4.2.
The altered class file is written to the server sub-directory located under the
directory defined by the DDL Service statement described in Section 4.3.4.
5.4.4
RMI Client Generation Phase
In the client generation phase a number of methods and fields, used to imple-
ment the recovery concern described in Section 5.3, are added to each client class
matched by pointcuts declared in the DDL.
As discussed in Section 4.5.3, distributed thread management is not sup-
ported so each matched method is checked to ensure that it does not contain the
synchronized keyword and there are no synchronized blocks in the methods. If
so, an error is generated. The existing method call is then replaced with an RMI
client version. E. g., the method:
public void foo(String name) {
// implementation code
}
contained in the class FooFoo with a recovery option of nextServer will be re-
placed with the code in Figure 5.4.
The altered class file is written to the client sub-directory located under the
directory defined by the DDL Service statement described in Section 4.3.4.
5.4.5
RMI Server Bootstrap
To bootstrap the server a class, org.remotej.RMIServer , is generated with a
main method defined that uses the RMI framework to:
1. Set the Java security manager to the RMISecurityManager .
2. Either locate an existing registry or start an embedded one.
3. For each class containing remote methods, the class is exported using the
UnicastRemoteObject.exportObject() method and the returned stub is
retrieved.
4. Finally, the returned stubs obtained from the call described above is added
to the RMI registry.
Search WWH ::




Custom Search