Li Zhongwei		zhongwei@cs.cornell.edu
XiangJiang Ma	mx16@cornell.edu
Yiwen Wang		yw49@cornell.edu

Reliable extension to NinjaRMI
=================
This is modified version of NinjaRMI v1.2, which adds server fault-tolerance and high-availability to NinjaRMI system

Setup environment
---------------
1. Set your system PATH containing the jdk1.2/bin
2. Be sure that the directory containing ninja is on your Java CLASSPATH. The code in NinjaRMI is part of the package ninja.rmi. 


Compile example
-----------------------
Our example application is modified from the CMU whiteboard application.
1. go to ../demo_example
2. cd whiteboard
3. javac *.java
4. rmic

Execute example
-----------------------
1. registry
2. server
3. client clientname(whatever)

Step 1,2 and 3 can be executed on different hosts, only if the classpath is correctly setup.
Noted that before running the application, please edit the executable batch files(server.bat, client.bat), change the host and port number to what the registry server is running on.

Compatibility
-----------------------
This new version of NinjaRMI is mostly source-compatible with Sun's RMI implementation (at least in JDK1.1). What this means is that making a few small modifications to existing code which uses Sun's RMI will allow the code to use NinjaRMI instead. In particular: 

1. In Sun's RMI implementation, remote objects must extend UnicastRemoteObject. With NinjaRMI, remote objects must extend NinjaRemoteObject instead. This is a one-line change to your code. 

2. NinjaRMI requires the use of the ninjarmic stub compiler, rather than Sun's rmic stub compiler. if you want to add the new reliable feature to your application. Please follow the following steps:
a>  Use the remote service name, which is used to binded with the remote reference in your registry server, as a parameter of your RMI server's constructer(The purpose is passing the service name to NinjaRemoteObject by calling NinjaRemoteObject(servicename)).
b>  Use "-rstub" as the compiler's optional argument(refer to rmic.bat).

3. NinjaRMI comes with its own RMI registry, which should be used instead of Sun's. Simply run java ninja.rmi.NinjaRegistryImpl to start the NinjaRMI registry. 

* In Whiteboard\alternative directory, there is another file WhiteboardServer.java which sends 
message to channel immediately when a server receives a message. It is model dependent to use 
immediate message-sending or periodical message-sending.