Tutorial
BRMI Tutorial
This section is intended to provide a step-by-step walk through of how
to transform a simple RMI application to a BRMI version.
Step 1 - Download BRMI package
Before starting, head over to the Download
section and grab BRMI. There are two parts of it, the first is BatchGen toolkit
used to automatically generate the client batching interface, the second is
BRMI runtime support package.
Step 2 - Using BatchGen
Using BatchGen generator is simple. just download our binary
distribution in jar format, then you can invoke it by typing 'java -jar
BatchGen.jar -batch' + packagename.classname.
Step 3 - Create the batching interface
Firstly let's create a simple interface for our example program. The
code for the legacy RMI program is as follow,
RemoteConditionalTest
then we can use BatchGen to automatically generate the Batch interface
by invoking it as,
C:\Yang\workspace>java -jar BatchGen.jar conditionalTest.RemoteConditionalTest
two interfaces will be generated, they are
BRemoteConditionalTest
and
CRemoteConditionalTest
They will be used as the client stub to communicate with BRMI server
runtime.
Step 4 - Service implementation
In this example, the remote services will be implemented as follows,
RemoteConditionalTestImpl
Step 5 - Invoking server
The server can be invoked as follows,
TestServer
Step 6 - Running client
The client can be invoked as follows,
TestClient
Congratulations!
That's it folks! Once you have a legacy RMI application, it's EASY to
rewrite it into BRMI one with a performance gain as much as you can imagine.