1 Lecture 21 – April 4, 2002 Dynamic Loading Communication in Bond Message delivery Internal and external message format KQML Synchronous and asynchrounous.

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

More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Multiplexing/Demux. CPSC Transport Layer 3-2 Multiplexing/demultiplexing application transport network link physical P1 application transport network.
Intermediate TCP/IP TCP Operation.
Remote Method Invocation
User Datagram Protocol. Introduction UDP is a connectionless transport protocol, i.e. it doesn't guarantee either packet delivery or that packets arrive.
Prepared By E. Musa Alyaman1 User Datagram Protocol (UDP) Chapter 5.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
Internet Programming In Java. References Java.sun.com Java552 Many of the programs shown.
Chapter 3 Review of Protocols And Packet Formats
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
TCP: Software for Reliable Communication. Spring 2002Computer Networks Applications Internet: a Collection of Disparate Networks Different goals: Speed,
Gursharan Singh Tatla Transport Layer 16-May
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
Web Proxy Server. Proxy Server Introduction Returns status and error messages. Handles http CGI requests. –For more information about CGI please refer.
TCP/IP Protocol Suite 1 Chapter 9 Upon completion you will be able to: Internet Control Message Protocol Be familiar with the ICMP message format Know.
Babak Esfandiari (based on slides by Qusay Mahmoud)
Assignment 3 A Client/Server Application: Chatroom.
Computer Networks  Network - A system of computers interconnected in order to share information.  Data transmission - consists of sending and receiving.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
1 Version 3.1 modified by Brierley Module 8 TCP/IP Suite Error and Control Messages.
1 Semester 2 Module 10 Intermediate TCP/IP Yuda college of business James Chen
Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)
LWIP TCP/IP Stack 김백규.
1 © 2003, Cisco Systems, Inc. All rights reserved. CCNA 2 Module 8 TCP/IP Suite Error and Control Messages.
VIII. UDP Datagrams and Sockets. The User Datagram Protocol (UDP) is an alternative protocol for sending data over IP that is very quick, but not reliable:
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 2.6 UDP Principles (Chapter 24) (User Datagram Protocol)
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
Data Streams David Meredith Source Chapter 19 of – Shiffman, D. (2008). Learning Processing. Morgan Kaufmann, Burlington, MA. ISBN:
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.
(Business) Process Centric Exchanges
Chapter 4: Interprocess Communication‏ Pages
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
CS390- Unix Programming Environment CS 390 Unix Programming Environment Java Socket Programming.
Network Programming Chapter 5: Raw Socket Programming.
Chapter 9 Hardware Addressing and Frame Type Identification 1.Delivering and sending packets 2.Hardware addressing: specifying a destination 3. Broadcasting.
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.
Socket Programming Lab 1 1CS Computer Networks.
Transport Layer3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley,
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
Java Programming II Java Network (I) Java Programming II.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 2.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
UDP: User Datagram Protocol Chapter 12. Introduction Multiple application programs can execute simultaneously on a given computer and can send and receive.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
Agenda Socket Programming The OSI reference Model The OSI protocol stack Sockets Ports Java classes for sockets Input stream and.
Netprog Java RMI1 Remote Method Invocation.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
RPC 6/14/20161BALAJI K - AP. Design issues of RPC Programming with interfaces Call Semantics associated with RPC Transparency and related to procedure.
Process-to-Process Delivery:
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Lecture 22 – April 9, 2002 Subprotocols – static and dynamic.
Chapter 9 ICMP.
Remote Method Invocation
Lecture 20 – April 2, 2002 Bond Objects.
Lecture 3 From process-oriented to agent-oriented programming.
Chapter 2: The Linux System Part 2
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
CPEG514 Advanced Computer Networkst
Internet Control Message Protocol
Parallel programming in Java
Multiplexing/Demux.
Process-to-Process Delivery: UDP, TCP
UDP Principles (Chapter 24) (User Datagram Protocol)
Presentation transcript:

1 Lecture 21 – April 4, 2002 Dynamic Loading Communication in Bond Message delivery Internal and external message format KQML Synchronous and asynchrounous communication Events – monitoring Communication Engines Base 64 encoding Virtual Networks of Objects

2 public class bondLoader extends bondObject { public Vector defaultpath = null; ClassLoader cloader = null; public bondLoader() { defaultpath = new Vector(); defaultpath.addElement("bond.core."); defaultpath.addElement("bond.services."); defaultpath.addElement("bond.agent."); defaultpath.addElement("bond.application."); defaultpath.addElement("bond.application.TupleSpa ce."); }

3 /** Create object "name" with default constructor given "searchpath" */ public Object load(String name, Vector searchpaths) { Object o = null; Class cl; try { if ((cl = loadClass(name, searchpaths)) != null) { o = cl.newInstance(); } } catch(IllegalAccessException cnfe) { } catch(InstantiationException ie) { } return o; }

4 /** Load a local class given its "name" */ public Class loadClass(String name, Vector searchpaths) { String completename; for(int i=0; i!=searchpaths.size(); i++) { try { Class cl = Class.forName(makeName (name, (String)searchpaths.elementAt(i))); return cl; } catch(ClassNotFoundException cnfe) { } catch(Exception ex) { } }

5 /** Load classes remotely */ if (cloader == null) { String c_repository = System.getProperty ("bond.current.strategy.repository"); String repository = System.getProperty ("bond.strategy.repository"); if (c_repository != null && repository != null) { try { URL urlList[] = {new URL(c_repository), new URL(repository)}; cloader = new URLClassLoader(urlList); } catch (MalformedURLException e) { } } else if (repository != null) { try { URL urlList[] = {new URL (repository)}; cloader = new URLClassLoader(urlList); } catch (MalformedURLException e) { } } } for (int i = 0; i < searchpaths.size(); i++) { try { Class cl = Class.forName(makeName(name, (String)searchpaths.elementAt(i)), true, cloader); return cl; } catch (ClassNotFoundException cnfe) { } catch(Exception ex) { } } return null; } }

6 Communication Multiple external message formats, Multiple transport mechanism, Dynamic collection of objects, Make communication simple.

7

8 Message delivery

9 Internal message format Internal format: unordered collection of name-value pairs implemented as dynamic properties of the bondMessage object. The name is a string The value can be any bondObject Reserved names: Addressing variables (source, destination,…) Message identifiers Semantic identifiers (give the context of the message) Hidden variables (variables removed before delivery)

10 External message representation KQML XML

11

12 Synchronous communication ask() and waitReply() ask()  blocks the current thread, all other threads continue to run.

13 bondMessage question = new bondMessage(``(ask- one : content get :value i :)'', ``PropertyAccess''); bondMessage rep = bs.ask(question, this, 10000); if (rep == null) { System.err.println(``Timeout of 10s exceeded''); } else { System.out.println(``Field i of remote object is''+ (String)rep.getParameter(``value'')); }

14 bondMessage question = new bondMessage(``(ask-one :content get :value i :)'', ``PropertyAccess''); question.needsReply(); bs.say(question, this);... code executed before the reply... rep = question.waitReply(10000);

15 Asynchronous communication The sender object uses the ask performative with reply- with field to send an asynchronous message. The communicator creates a message waiting slot for the sender object and deposits there a copy of the original message and the unique ID of the reply. Eventually the receiver object replays using the tell performative. When processing incoming messages, the communicator checks the waiting slot table for the unique ID of the message and if a waiting slot exists, the communicator delivers the message to it. If the incoming messages has the on_reply field set then it is delivered directly, else it is delivered by the say() method.

16

17 Event handling

18 Events/monitoring An event could be the change of a property of a Bond object. The set() function executed by the object being monitored notifies the monitor when a property subject to monitoring changes.

19

20 The communicator – the sending side for(every sent message) if (external format) transform message in internal format annotate with the sender address if (reply needed) { annotate with a unique reply-with field create a reply waiting slot } if (performative is subscribe) create an event waiting slot if (performative is unsubscribe) delete the event waiting slot if (need to send info to destination) annotate with the piggyback field pass the message to communicator engine

21 The communicator – the receiving side for(every incoming message) parse message remove the piggyback field if any if (has in-reply-to field) and (in-reply-to field maches a reply waiting slot) then { deliver to object waiting on the reply waiting slot delete the reply waiting slot } else if (performative is tell) and (sender maches an event waiting slot) then deliver to object waiting on the event waiting slot else lookup the destination object if (destination is alias) select an object with the alias at random else look up the object in local dir if (no object) { send error message to sender wake up a thread in the threadpool deliver the message using the thread } }

22 Communication Engines Multiple communication engines: TCP UDP Infospheres – based upon RMI IP multicast Each communication engine has a deamon to send and receive messages using the specific communication engine.

23 public class bondUDPDaemon extends bondObject { public bondUDPDaemon(int port) throws SocketException { super(false); udpSocket = new DatagramSocket(port); localport = port; } public int getLocalPort(){return localport;} public void send(InetAddress targetIP, int targetPort, String m) { bufOut = m.getBytes(); udpOutPacket = new DatagramPacket(bufOut, bufOut.length, targetIP, targetPort); try{udpSocket.send(udpOutPacket);} catch(IOException e){} }

24 public String receive() { try{ udpInPacket = new DatagramPacket(bufIn, 65535); udpSocket.receive(udpInPacket); InetAddress fromAddress = udpInPacket.getAddress(); fromHostname = fromAddress.getHostName(); fromPort = udpInPacket.getPort(); String mes = new String(udpInPacket.getData(), 0, udpInPacket.getLength()); return mes;} catch(IOException e){ return null; } }

25 Sending an object – realize() public void sendObject(bondShadow bs, bondObject bo, String in_reply_to) { bondExternalMessage bm = new bondExternalMessage(); bm.in_reply_to = in_reply_to; bm.bo = bo; String m = Base64.Object2String(bm); try{ InetAddress targetIP = InetAddress.getByName (bs.remote_address.ipaddress); bondUDPDaemon.send(targetIP, bs.remote_address.port, m);} catch(UnknownHostException e){e.printStackTrace();} }

26 Base 64 encoding Take a 24 bit sequence from the source. If fewer than 24 bits are available use the "=" character for padding. Separate the sequence into 4 six bit characters. View each character as the lower 6 bits of an 8 bit character by padding it to the left with 00. With six bits one could encode 64 characters. Use each 8 bit character constructed in the previous as an index into the Base64 alphabet: "ABCDEFGHIJKLMNOPQSTUVWXYZabcdefghijk lmnopqrstuvwxyz /="

27 Virtual Networks of Objects