CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.

Slides:



Advertisements
Similar presentations
COS 461 Fall 1997 Network Objects u first good implementation: DEC SRC Network Objects for Modula-3 u recent implementation: Java RMI (Remote Method Invocation)
Advertisements

RMI Varun SainiYing Chen. What is RMI? RMI is the action of invoking a method of a remote interface on a remote object. It is used to develop applications.
Remote Method Invocation CS587x Lecture Department of Computer Science Iowa State University.
15-May-15 RMI Remote Method Invocation. 2 “The network is the computer” Consider the following program organization: If the network is the computer, we.
Remote Method Invocation
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Introduction to Remote Method Invocation (RMI)
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Internet Software Development Remote Method Invocation Paul Krause.
Io package as Java’s basic I/O system continue’d.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
NET0183 Networks and Communications Lecture 31 The Socket API 8/25/20091 NET0183 Networks and Communications by Dr Andy Brooks Lecture powerpoints from.
1 Java Programming II Java Network II (Distributed Objects in Java)
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Chapter 4 Distributed objects and Remote Method Invocation
15 - RMI. Java RMI Architecture Example Deployment RMI is a part of J2SE (standard edition), but is used by J2EE) A J2EE server is not nessesary for using.
Graphical User Interface CSI 1101 N. El Kadri. Plan - agenda Graphical components Model-View-Controller Observer/Observable.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Java RMI: Remote Method Invocation January 2000 Nancy McCracken Syracuse University.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
RMI Continued IS Outline  Review of RMI  Programming example.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
Java Remote Object Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
 Remote Method Invocation  A true distributed computing application interface for Java, written to provide easy access to objects existing on remote.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 43 Remote Method Invocation.
Li Tak Sing COMPS311F. RMI callbacks In previous example, only the client can initiate a communication with the server. The server can only response to.
Java Remote Method Invocation (RMI) Overview of RMI Java RMI allowed programmer to execute remote function class using the same semantics as local functions.
1 Java Remote Method Invocation java.rmi.* java.rmi.registry.* java.rmi.server.*
Creating Applications Using RMI Lesson 1B / Slide 1 of 19 Network and Distributed Programming in Java Pre-assessment Questions 1.Which of the following.
 Java RMI Distributed Systems IT332. Outline  Introduction to RMI  RMI Architecture  RMI Programming and a Sample Example:  Server-Side RMI programming.
Remote Method Invocation A Client Server Approach.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Java RMI. RMI Any object whose methods can be invoked from another Java VM is called a remote object.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 Java API for distributed computing.
CSC 480 Software Engineering Lab 6 – RMI Nov 8, 2002.
Netprog Java RMI1 Remote Method Invocation.
import java.io.*; public class Customer implements Serializable { public Customer(int theAge, int theSex, String[] theHobbies) { age = theAge; sex.
Using RMI The Example of A Remote Calculator 1. Parts of A Working RMI System A working RMI system is composed of several parts. –Interface definitions.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 29 Remote Method.
January 26, Ann Wollrath Copyright 1999 Sun Microsystems, Inc., all rights reserved. Java ™ RMI Overview Ann Wollrath Senior Staff Engineer Sun Microsystems,
GUI- Model-View-Controller
RMI Packages Overview java.rmi java.rmi.server java.rmi.registry
Remote Method Invocation
Java RMI (more) CS-328 Internet Programming.
null, true, and false are also reserved.
Chapter 40 Remote Method Invocation
Remote method invocation (RMI)
Chapter 46 Remote Method Invocation
Using RMI -The Example of A Remote Calculator
Chapter 46 Remote Method Invocation
GUI- Model-View-Controller
Java Chapter 5 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina

4/13/20042 An RMI Chat with Callback Example An RMI-based client/server chat system with callback mechanism Define remote interfaces RMICallbackServer and RMICallbackClient Server class RMICallbackServerImpl accepts client registration through interface RMICallbackServer Client class RMICallbackClientImpl sends messages to server and server broadcasts messages to each registered client through interface RMICallbackClient

4/13/20043 Interface RMICallbackServer /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.rmi.*; public interface RMICallbackServer extends Remote { public static final String REGISTRY_NAME = "Callback Server"; public abstract void register (RMICallbackClient client) throws RemoteException; public abstract void deregister (RMICallbackClient client) throws RemoteException; public abstract void say (String message) throws RemoteException; }

4/13/20044 Interface RMICallbackClient /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.rmi.*; public interface RMICallbackClient extends Remote { public abstract void said (String message) throws RemoteException; }

4/13/20045 Class RMICallbackServerImpl /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.rmi.*; import java.util.*; import java.rmi.server.*; import java.rmi.registry.*; public class RMICallbackServerImpl extends UnicastRemoteObject implements RMICallbackServer { // public RMICallbackServerImpl () throws RemoteException … // public void register (RMICallbackClient client) … // public void deregister (RMICallbackClient client) … // public void say (String message) … // public static void main (String[] args) throws RemoteException … }

4/13/20046 Methods of RMICallbackServerImpl protected Vector clients; public RMIChatServerImpl () throws RemoteException { clients = new Vector (); } public void register (RMICallbackClient client) { try { say (getClientHost () + " has joined."); } catch (ServerNotActiveException ignored) { } clients.addElement (client); } public void deregister (RMICallbackClient client) { clients.removeElement (client); try { say (getClientHost () + " has left."); } catch (ServerNotActiveException ignored) { }

4/13/20047 Method say public void say (String message) { Vector clients = (Vector) this.clients.clone (); for (int i = 0; i < clients.size (); ++ i) { RMICallbackClient client = (RMICallbackClient) clients.elementAt (i); try { client.said (message); } catch (RemoteException ex) { this.clients.removeElement (client); }

4/13/20048 Method main public static void main (String[] args) throws RemoteException { RMICallbackServerImpl callbackServer = new RMICallbackServerImpl (); Registry registry = LocateRegistry.getRegistry (); registry.rebind (REGISTRY_NAME, callbackServer); }

4/13/20049 Class RMICallbackClientImpl /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.awt.*; import java.rmi.*; import java.awt.event.*; import java.rmi.server.*; import java.rmi.registry.*; public class RMICallbackClientImpl extends UnicastRemoteObject implements RMICallbackClient, ActionListener{ // public RMICallbackClientImpl (String host) throws RemoteException … // public synchronized void start () throws RemoteException, NotBoundException … // public synchronized void stop () throws RemoteException … // public void said (String message) … // public void actionPerformed (ActionEvent ev) … // public static void main (String[] args) throws RemoteException, NotBoundException … }

4/13/ Constructor RMICallbackClientImpl protected String host; protected Frame frame; protected TextField input; protected TextArea output; public RMICallbackClientImpl (String host) throws RemoteException { this.host = host; frame = new Frame ("RMICallbackClientImpl [" + host + "]"); frame.add (output = new TextArea (), "Center"); output.setEditable (false); frame.add (input = new TextField (), "South"); input.addActionListener (this); frame.addWindowListener (new WindowAdapter () { public void windowOpened (WindowEvent ev) { input.requestFocus (); } public void windowClosing (WindowEvent ev) { try { stop (); } catch (RemoteException ex) { ex.printStackTrace (); } }); frame.pack (); }

4/13/ Methods start, stop, and said protected RMICallbackServer server; public synchronized void start () throws RemoteException, NotBoundException { if (server == null) { Registry registry = LocateRegistry.getRegistry (host); server = (RMICallbackServer) registry.lookup (RMICallbackServer.REGISTRY_NAME); server.register (this); frame.setVisible (true); } public synchronized void stop () throws RemoteException { frame.setVisible (false); RMICallbackServer server = this.server; this.server = null; if (server != null) server.deregister (this); } public void said (String message) { output.append (message + "\n"); }

4/13/ Method actionPerformed public void actionPerformed (ActionEvent ev) { try { RMICallbackServer server = this.server; if (server != null) { server.say (ev.getActionCommand ()); input.setText (""); } } catch (RemoteException ex) { input.setVisible (false); frame.validate (); ex.printStackTrace (); }

4/13/ Method main public static void main (String[] args) throws RemoteException, NotBoundException { if (args.length != 1) throw new IllegalArgumentException ("Syntax: RMICallbackClientImpl "); RMICallbackClientImpl callbackClient = new RMICallbackClientImpl (args[0]); callbackClient.start (); }

4/13/ Disadvantages of Example For every client, need to maintain two network connections, one incoming and one outgoing Connections will timeout and need to be periodically reestablished

4/13/ An RMI Distributed List Example Client and server maintain list state in local IDList object When an update is attempted to a client list, makes a remote method call on server If server approves the change, it makes remote method calls on all registered clients to indicate the change

4/13/ Interface DistributedList /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.util.*; public interface DistributedList { public abstract void addElement (Object element); public abstract void updateElement (Object oldElement, Object newElement); public abstract void replaceElement (Object oldElement, Object newElement); public abstract void removeElement (Object element); public abstract Enumeration getElements (); public abstract void addChangeListener (ChangeListener listener); public abstract void removeChangeListener (ChangeListener listener); }

4/13/ Interface ChangeListener /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.util.*; public interface ChangeListener extends EventListener { public abstract void changeOccurred (ChangeEvent changeEvent); }

4/13/ Class ChangeEvent /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.util.*; public class ChangeEvent extends EventObject { public ChangeEvent (Object source) { super (source); }

4/13/ Class ID /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.io.*; public class ID implements Serializable { protected int id; public ID (int id) { this.id = id; } public boolean equals (Object other) { return (other != null) && (other instanceof ID) && (((ID) other).id == id); } public int hashCode () { return id; }

4/13/ Class IDList /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.io.*; import java.util.*; public class IDList implements Serializable { // public IDList () … // public synchronized ID allocateID () … // public synchronized boolean addElement (ID id, Object element) … // public synchronized boolean updateElement (ID oldID, ID id, Object element) … // public synchronized boolean replaceElement (ID oldID, ID id, Object element) … // public synchronized boolean removeElement (ID id) … // public synchronized ID getID (Object element) … // public Enumeration getElements () … // public synchronized Object clone () … }

4/13/ Constructor IDList protected Vector ids, elements; public IDList () { ids = new Vector (); elements = new Vector (); }

4/13/ Methods of IDList protected int id; public synchronized ID allocateID () { return new ID (id ++); } protected int updateCount; public int getUpdateCount () { return updateCount; } public synchronized boolean addElement (ID id, Object element) { if (ids.contains (id)) return false; ids.addElement (id); elements.addElement (element); ++ updateCount; return true; }

4/13/ Methods of IDList public synchronized boolean updateElement (ID oldID, ID id, Object element) { int index = ids.indexOf (oldID); if (index < 0) return false; ids.setElementAt (id, index); elements.setElementAt (element, index); ++ updateCount; return true; } public synchronized boolean replaceElement (ID oldID, ID id, Object element) { int index = ids.indexOf (oldID); if (index < 0) return false; ids.removeElementAt (index); elements.removeElementAt (index); ids.addElement (id); elements.addElement (element); ++ updateCount; return true; }

4/13/ Methods of IDList public synchronized boolean removeElement (ID id) { int index = ids.indexOf (id); if (index < 0) return false; ids.removeElementAt (index); elements.removeElementAt (index); ++ updateCount; return true; } public synchronized ID getID (Object element) { int index = elements.indexOf (element); if (index < 0) return null; else return (ID) ids.elementAt (index); } public Enumeration getElements () { return ((Vector) elements.clone ()).elements (); }

4/13/ Methods of IDList public synchronized Object clone () { try { IDList idList = (IDList) super.clone (); idList.ids = (Vector) ids.clone (); idList.elements = (Vector) elements.clone (); return idList; } catch (CloneNotSupportedException ignored) { return null; }

4/13/ Interface RMIListServer /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.rmi.*; public interface RMIListServer extends Remote { public abstract IDList register (RMIListClient client) throws RemoteException; public abstract void deregister (RMIListClient client) throws RemoteException; public abstract void addElement (Object element) throws RemoteException; public abstract void updateElement (ID id, Object newElement) throws RemoteException; public abstract void replaceElement (ID id, Object newElement) throws RemoteException; public abstract void removeElement (ID id) throws RemoteException; }

4/13/ Interface RMIListClient /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.rmi.*; public interface RMIListClient extends Remote { public abstract void elementAdded (ID id, Object element) throws RemoteException; public abstract void elementUpdated (ID oldID, ID id, Object element) throws RemoteException; public abstract void elementReplaced (ID oldID, ID id, Object element) throws RemoteException; public abstract void elementRemoved (ID id) throws RemoteException; }

4/13/ Class RMIListServerImpl /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.rmi.*; import java.util.*; import java.rmi.server.*; import java.rmi.registry.*; public class RMIListServerImpl extends UnicastRemoteObject implements RMIListServer { // public RMIListServerImpl () throws RemoteException … // public synchronized IDList register (RMIListClient client) … // public synchronized void deregister (RMIListClient client) … // public synchronized void addElement (Object element) … // public synchronized void updateElement (ID id, Object element) … // public synchronized void replaceElement (ID id, Object element) … // public synchronized void removeElement (ID id) … // public static void main (String[] args) throws RemoteException, AlreadyBoundException … }

4/13/ Constructor RMIListServerImpl protected IDList idList; protected Vector clients; public RMIListServerImpl () throws RemoteException { idList = new IDList (); clients = new Vector (); }

4/13/ Methods of RMIListServerImpl public synchronized IDList register (RMIListClient client) { clients.addElement (client); return idList; } public synchronized void deregister (RMIListClient client) { clients.removeElement (client); }

4/13/ Methods of RMIListServerImpl public synchronized void addElement (Object element) { ID id = idList.allocateID (); if (idList.addElement (id, element)) { for (int i = 0; i < clients.size (); ++ i) { try { ((RMIListClient) clients.elementAt (i)).elementAdded (id, element); } catch (RemoteException ex) { clients.removeElementAt (i --); } public synchronized void updateElement (ID id, Object element) { ID newID = idList.allocateID (); if (idList.updateElement (id, newID, element)) { for (int i = 0; i < clients.size (); ++ i) { try { ((RMIListClient) clients.elementAt (i)).elementUpdated (id, newID, element); } catch (RemoteException ex) { clients.removeElementAt (i --); }

4/13/ Methods of RMIListServerImpl public synchronized void replaceElement (ID id, Object element) { ID newID = idList.allocateID (); if (idList.replaceElement (id, newID, element)) { for (int i = 0; i < clients.size (); ++ i) { try { ((RMIListClient) clients.elementAt (i)).elementReplaced (id, newID, element); } catch (RemoteException ex) { clients.removeElementAt (i --); } public synchronized void removeElement (ID id) { if (idList.removeElement (id)) { for (int i = 0; i < clients.size (); ++ i) { try { ((RMIListClient) clients.elementAt (i)).elementRemoved (id); } catch (RemoteException ex) { clients.removeElementAt (i --); }

4/13/ Method main public static void main (String[] args) throws RemoteException, AlreadyBoundException { if (args.length != 2) throw new IllegalArgumentException ("Syntax: RMIListServerImpl "); RMIListServerImpl listServer = new RMIListServerImpl (); Registry registry = LocateRegistry.createRegistry (Integer.parseInt (args[0])); registry.bind (args[1], listServer); }

4/13/ Class RMIListClientImpl /* Java Network Programming, Second Edition * Merlin Hughes, Michael Shoffner, Derek Hamner * Manning Publications Company; ISBN X * * * * Copyright (c) Merlin Hughes, Michael Shoffner, Derek Hamner; * all rights reserved; see license.txt for details. */ import java.rmi.*; import java.util.*; import java.rmi.server.*; import java.rmi.registry.*; public class RMIListClientImpl implements DistributedList { // public RMIListClientImpl (String host, int port, String service) … // public synchronized void start () throws RemoteException, NotBoundException … // public synchronized void stop () throws RemoteException … // public synchronized void addElement (Object element) … // public synchronized void updateElement (Object oldElement, Object newElement) … // public synchronized void replaceElement (Object oldElement, Object newElement) … // public synchronized void removeElement (Object element) … // public Enumeration getElements () … // public void addChangeListener (ChangeListener listener) … // public void removeChangeListener (ChangeListener listener) … // protected void fireChangeEvent (ChangeEvent changeEvent) … // class Callback implements RMIListClient … }

4/13/ Constructor RMIListClientImpl protected String host, service; protected int port; public RMIListClientImpl (String host, int port, String service) { this.host = host; this.port = port; this.service = service; }

4/13/ Methods of RMIListClientImpl protected IDList idList; protected RMIListClient myself; protected RMIListServer listServer; public synchronized void start () throws RemoteException, NotBoundException { if (listServer == null) { myself = (RMIListClient) UnicastRemoteObject.exportObject (new Callback ()); Registry registry = LocateRegistry.getRegistry (host, port); listServer = (RMIListServer) registry.lookup (service); try { idList = listServer.register (myself); } catch (RemoteException ex) { listServer = null; throw ex; } fireChangeEvent (new ChangeEvent (this)); } public synchronized void stop () throws RemoteException { try { if (listServer != null) listServer.deregister (myself); } finally { listServer = null; UnicastRemoteObject.unexportObject (myself, true); }

4/13/ Methods of RMIListClientImpl public synchronized void addElement (Object element) { if (listServer != null) { try { listServer.addElement (element); } catch (RemoteException ex) { listServer = null; } public synchronized void updateElement (Object oldElement, Object newElement) { if (listServer != null) { ID id = idList.getID (oldElement); if (id != null) { try { listServer.updateElement (id, newElement); } catch (RemoteException ex) { listServer = null; }

4/13/ Methods of RMIListClientImpl public synchronized void replaceElement (Object oldElement, Object newElement) { if (listServer != null) { ID id = idList.getID (oldElement); if (id != null) { try { listServer.replaceElement (id, newElement); } catch (RemoteException ex) { listServer = null; } public synchronized void removeElement (Object element) { if (listServer != null) { ID id = idList.getID (element); if (id != null) { try { listServer.removeElement (id); } catch (RemoteException ex) { listServer = null; } public Enumeration getElements () { return idList.getElements (); }

4/13/ Methods of RMIListClientImpl protected Vector listeners = new Vector (); public void addChangeListener (ChangeListener listener) { listeners.addElement (listener); } public void removeChangeListener (ChangeListener listener) { listeners.removeElement (listener); } protected void fireChangeEvent (ChangeEvent changeEvent) { synchronized (listeners) { for (int i = 0; i < listeners.size (); ++ i) ((ChangeListener) listeners.elementAt (i)).changeOccurred (changeEvent); }

4/13/ Inner Class Callback class Callback implements RMIListClient { public void elementAdded (ID id, Object element) { idList.addElement (id, element); fireChangeEvent (new ChangeEvent (RMIListClientImpl.this)); } public void elementUpdated (ID oldID, ID id, Object element) { idList.updateElement (oldID, id, element); fireChangeEvent (new ChangeEvent (RMIListClientImpl.this)); } public void elementReplaced (ID oldID, ID id, Object element) { idList.replaceElement (oldID, id, element); fireChangeEvent (new ChangeEvent (RMIListClientImpl.this)); } public void elementRemoved (ID id) { idList.removeElement (id); fireChangeEvent (new ChangeEvent (RMIListClientImpl.this)); }

4/13/ Summary of RMI RMI framework hides low-level networking details in the guise of remote method calls Different style than using streams and sockets Each style has its own uses Sockets are useful when interacting with other socket-based applications and when full control of communication channel is needed RMI is good in designing cleaner high-level protocols, in request-based applications, and in peer-to-peer applications

4/13/ Next Class Telnet and rlogin File transfer protocol (FTP) Read TI Ch. 26, 27