Distributed Computing Remote Method Invocation R.M.I. Gheorghe Aurel Pacurar
Distributed Computing using RMI Remote Method Invocation (RMI) allows object-to-object communication between different Java Virtual Machines. (JVM) Besides RMI are : Sockets Java Message Service (JMS)
RMI Architecture RMI is the action of invoking a method of the remote object. A Remote Object is describe as remote methods by his Remote Interface. A Remote Object is create and registrate bind by an RMI Server in Naming space. An other object on the other JVM can : casting to the Remote Interface an instance of an lookup object. call a Remote Method on his JVM
RMI Architecture OSI Model Invoking Remote Method Remote Object APPLICATION Layer STUB SKELETON PRESENTATION Layer REMOTE REFERENCE LAYER REMOTE REFERENCE LAYER SESSION Layer TCP TCP TRANSPORT Layer IP IP NETWORK Layer HARDWARE INTERFACE CLIENT HARDWARE INTERFACE SERVER DATALINK Layer
RMI Custom sockets and SSL/TSL A SOCKET is an end-point of communication Exist : Client / CONECTION Socket Server / LISTENING Socket RemoteInterface SKELETON 1099 RemoteInterface STUB RMI REGISTRY clientobj =(RemoteInterface) Naming.lookup( ROM ) CONNECTION (Cached!) Naming.bind( ROM, remobj) Remote Object 1150 Remote Object remobj Remote Method Invocation Mentors for students, CLIENT not students for mentors! SERVER
RMI Server : RMI Applications Create the REMOTE OBJECT INTERFACE Create the REMOTE OBJECT class implements REMOTE OBJECT INTERFACE Create class, object and start RMI SERVER Generate SKELETON and STUB : rmic Bind/Rebind the REMOTE OBJECT with a public name in the server code RMI Registry : Start rmiregistry Service on server Create and open a Server Socket, default on 1099 port. Listening on opened Server Socket RMI Client : Look up for a REMOTE OBJECT INTERFACE CASTING to Remote Object Interface a local object Remote Method Invocation (RMI) for local object Create and open a Client Socket and establish the communication with Server Socket
RMI Server : RMI Applications RMI Server public Interface RemoteInterface extends Remote{ void remotemethode1() throws RemoteException; void remote Methode2() throws RemoteException; Public class RemoteObjectClass extends UnicastRemoteObject implements RemoteInterface{ void remotemethode1() throws RemoteException{ System.out.println( Remote methode1 ); void remote Methode2() throws RemoteException{{ System.out.println( Remote methode2 ); Public class ServerRMI{ public static void main() { RemoteObjectClass remoteobject = new RemoteObjectClass(); Naming.rebind( RemoteObject,remoteObject);
RMI Applications RMI Client RMI Client: Public class ClientRMI{ public static void main() { RemoteObjectClass remoteobjectstub = (RemoteInterface) (Naming.lookup( RemoteObject )); // Remote Methode Invocation remoteobjectstub.methode1(); remoteobjectstub.methode2(); Generate stub and skeleton rmic.exe
RMI Applications - RMI Registry RMI Registry: rmiregistry.exe (default with java.security file) JSEE provider instaling on the client maschine Static : java.security file Dynamic Security.addProvider(new com.sun.net.ssl.internal.ssl.provider);
RMI, Firewalls and HTTP Methods to bypass the Firewall: HTTP Tunneling HTTP-to-Port HTTP-to-CGI SOCKS (Socket Server) : networking proxi protocol that enabled hosts on the side of SOCKS server to gain full access to host on the other side of the SOCKS Server without requiring direct IP reachability. Download Sockets Factories
Thank you! Any suggestion, comment and critics are more than welcome: gheorghe.pacurar@a-sti.ro