CentiJ: An RMI Code Generator

Douglas Lyon
2002 Journal of Object Technology  
The CentiJ system synthesizes Java source code that funnels invocations through an RMI (Remote Method Invocation) based transport layer for distributed computation. The technique generates bridge pattern code (i.e., interfaces and proxies) that automate the creation of virtual proxies for message forwarding. We examine the tradeoffs between bridge implementations based on manual static delegation, automatic static delegation, and dynamic proxy classes. Advantages of the CentiJ technique include
more » ... J technique include improved performance, type safety, transparency, predictability, flexibility and reliability. We then look at various methods for solving the disambiguation problem that arises when delegates have conflicting method signatures. Disambiguation can be automatic, semi-automatic or manual. CentiJ can automatically create a class that alters the interface to the bridge (using the adapter pattern). Java technology supports distributed computing on heterogeneous networks via a technology called RMI and CORBA [Lea] [Jennings]. To do this, RMI provides a communication framework for distributed computation in a remote address space. RMI is a de factor standard for communication between systems written in different languages [Slominski]. Sorry to say, use of the RMI technology often requires significant programmer effort and the writing of extra source code. The CentiJ project eases this programmer burden. CentiJ enables the remove invocation of existing, (i.e., legacy) code, without changing it. We funnel the communications through a bridge that is remotely invoked. C ENTIJ: AN RMI CODE GENERATOR 118 J OURNAL OF OBJECT TECHNOLOGY V OL. 1, NO. 5 All the communications are encapsulated in the CentiJ generated code so that the CentiJ programmer does not need to modify the code (provided it uses the bridge interface). The contribution of CentiJ is that it reuses original implementations, without altering the source code and provides for a means of distributing the computations. CentiJ works for programs that were not written with distributed computation in mind. The RMI Problem The RMI problem can be broken down into two sub-problems. The first is called the legacy bridge problem. The second is called the virtual proxy synthesizer problem. The legacy bridge problem may be stated simply as follows, given a large number of methods in a variety of classes, find a single interface to these methods and an implementing class so that there is a reuse of the implementations in the existing (i.e., legacy code). We are subject to the constraint that we cannot change the existing code. Further we may not even have the existing source code. The legacy bridge problem is solved by building code that implements the bridge pattern. The bridge pattern consists of an interface, or protocol of communication and an implementation of the communication. Any network layer protocol can use a bridge pattern. Legacy code is often fragile, hard to maintain, difficult to reverse engineer, unchangeable and sometimes poorly designed. Hence the constraint that we can not change the legacy code base. Subject to these constraints, CentiJ builds a bridge between new code and the legacy system. Thus providing a solution to the legacy bridge problem. The virtual proxy problem is the second sub-problem solved by CentiJ. With the virtual proxy, the goal is to method-forward to an existing implementation. CentiJ uses inputs from the legacy bridge problem and generates code that can be invoked on a remote address space. Thus, CentiJ solves the RMI problem by gathering the implementations of a set of classes and generating a virtual proxy.
doi:10.5381/jot.2002.1.5.a2 fatcat:lc2fbt2sdbc4nn7vmeggyn2ksy