Cst556 Distributed Applications for .NET with Mono 4 ...pooh.poly.asu.edu/Cst556/ClassNotes/cnRemoting.pdf · applications to be developed at the object level rather than via TCP
Post on 13-Aug-2020
0 Views
Preview:
Transcript
Page 1
cnRemoting.fm Course Review Notes
with Mono
Distributed Applications for Windows © T. Lindquist 2019 February 2019
Cst556 Distributed Applications for .NET
4. Remoting with .NET
Page 2
cnRemoting.fm Course Review Notes
eferences
uted applications #? Remoting nt and server.
ows distributed than via TCP data
ngleton and Client-pplications best ations that utilize
ifetimes of Remote
ter and return types
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.a .NET Remoting: Outcomes and R
4.a.1 Motivation and Outcomes• What is .NET Remoting and how can I develop distrib
using Remoting Object Servers and their Clients in Cprovides for object-level communication between clie
• Section Outcomes
- To understand what it means to say that remoting allapplications to be developed at the object level ratherprotocols.
- To understand the differences between SingleCall, SiActivated remote object servers and the distributed asuited for each. To be able to develop C# .NET appliceach.
- To understand the leasing mechanism for controlling lObjects.
- To understand limitations on and handling of paramefor remoting applications.
Page 3
cnRemoting.fm Course Review Notes
Remoting
ft Press, Chapter 15
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.a.2 References for .NET Remoting• C# Web Services (course textbook) Chapter 6 on .NET
Architecture• C# for Java Developers by Jones and Freeman, Microso
Page 4
cnRemoting.fm Course Review Notes
emotingivated Pencil
d Pencil Servervated PencilServerg Example with
moting Examplefor notification:
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.a.3 Index to Example Programs for .NET R- Server-activated: Section 4.d.4 Example Server-Act
Server- Single-call: Section 4.d.4 Example Server-Activate- Client-activated: Section 4.d.6 Example Client-Acti- User-defined parameter types: Section 4.f.2 Remotin
User-Defined Parameter Types- Using leases: Section 4.f.4 Leases in GroupMgr Re- Remote Server that Registers and calls-back clients
Section 4.g.2 Solution Approach
Page 5
cnRemoting.fm Course Review Notes
jects
allow components level. and/or on different application.mail client and
riented way, guments for the e. are all handled by
ote machine:ts with data
n, enhance, and use.
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.b Introduction to Distributed Ob4.b.1 What are Distributed Objects?
• Distributed objects as realized through .NET Remotingof distributed applications to communicate at the object- Components, which may reside in different processes
machines are viewed as separate executing parts of an- Example components are browser and http server, e
imap server, as well as their subparts.- Components send each other messages in an object-o
consisting of a method to be invoked together with armethod. The result of a message may be a return valu
- Arguments, call synchronization and return valuesplatform; not by the application developer.
• Without distributed objects, sending a message to a rem- Current protocols (http, ftp, telnet) use stream socke
protocols, or RPC- Current protocols are data centric, difficult to maintai
Page 6
cnRemoting.fm Course Review Notes
objects.
r each other and
d/or follow mobile .
gister themselves the registry and ompeting) services.
middleware issues
nchronization?
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.b.2 Vision of Distributed Object Computing
• Applications are federations of cooperating distributed
- Configuration may be dynamic - objects can discovecommunicate to perform some service for each other.
- Distributed Objects can survive network outages anparadigms where connectivity is constantly changing
- Distributed Objects may be service providers that rewith multiple registries. Potential clients may contactdiscover information about compatible (and maybe c
• View the Internet as an Object Bus
• Distributed Object technologies remove the underlying from applications and their developers.
- How to implement message passing and argument sy
- What if objects are not “in-process”?
- Distinction between objects within LAN versus WAN
Page 7
cnRemoting.fm Course Review Notes
ice Competitors
bject model
ent Group
n) hindered usage.
tomatic dynamic each application.bage collection.web server-specific
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.b.3 .NET Remoting and ASP.NET Web Serv• Distributed COM and its evolutions by Microsoft
- Multi-language, single platform- constrained functionally by not including complete o
• Common Object Request Broker by Object Managem- Multi-language, multi-platform,- Sacrificed ease of use and functionality.- Lagging Pass-By-Value implementations (serializatio
• Remote Method Invocation in SUN’s Java- Single language, multiple platform- Easy to use and conceptually clean, although with au
class loading security must be carefully addressed for- Incurs burdon of net-wide reference counting and gar- Lots of Intranet application including J2EE and other
support applications.
Page 8
cnRemoting.fm Course Review Notes
motinguted application
he cliente as fast as web eroperability).
AP and HTTP
SOAP)xample, Java client
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.b.4 ASP.NET Web Services versus .NET Re• .NET Framework includes two mechanisms for distrib
development:- ASP.NET Web Services- .NET Remoting
• Remoting can use different transport mechanisms- A native binary TCP based protocol- SOAP and HTTP- Object references and a proxy object are utilized by t- Remoting is a fast (binary formatted remoting is twic
services) solution for .NET clients and servers (no int
• ASP.NET Web Services expose web methods using SOthrough an IIS web server.- Developed based on open standards (WSDL, UDDI,- Intended to allow across development platforms (for e
accessing an ASP.NET Web Service).
Page 9
cnRemoting.fm Course Review Notes
tions
ng system processample) is achieved
or each application.age runtime’s pplication.
machine within a
gram control.ins (code not data),
bjects in another
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.c Background of .NET Applica4.c.1 View of ASP.NET Remoting
• Multiple .NET applications can run in the same operati- Application isolation (for transactions, security, for ex
by defining Application Domains within a process f- An Application Domain is the .NET common langu
version of a “light weight” process for executing an a- See the System.AppDomain class
• ASP.NET hosts all ASP.NET applications on a given single process.
• Each Application Domain consists of Assemblies- Assemblies can be loaded under program control.- The Application Domain can be unloaded under pro- An Assembly can be shared by all Application Doma
which is called a Domain-Neutral Assembly• Objects in one Application Domain can’t interact with o
except through Remoting.
Page 10
cnRemoting.fm Course Review Notes
ssemblys outside the core
services such as:
t called the Contextssociated with a its execution.
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.c.2 .NET Base Class Library• The Base Class Library is spread over two assemblies
- MSCorLib.dll- System.dll
• MSCorLib.dll is always loaded as a domain neutral a- To keep it as small as possible, there are no reference
library.
• .NET provides that classes can be configured to require- synchronization,- security,- just-in-time activation, and- transactions
• These available services make up a runtime environmen- Classes (objects) within an Application Domain are a
Context that defines the resources and constraints on
Page 11
cnRemoting.fm Course Review Notes
Domainuires eitherjectsote objects
limited to the
arked [Serializable]ng the object - a stream.n by deserializing.
pplication Domain,
nal object.eiving results
plication domain.
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.c.3 Communication outside the Application• Any communication outside the application domain req
- Marshal by Value Objects, which are serializable ob- Marshal by Reference Objects, which are called rem
• Any objects that are neither remote nor serializable areapplication domain in which they are created.
• Serializable objects -implement ISerializable or are m- Marshalled as they leave an Application by serializi
(creating a copy) and then transporting them through - Unmarshalled on entering a new Application Domai
• Remote objects- Extend System.MarshalByRefObject- When a remote object reference is imported into an A
a proxy object is created in the receiving Domain.- The proxy has a method for each method in the origi- Proxy object methods handle calling methods and rec
utilizing a Tcp or Http channel to another process/ap
Page 12
cnRemoting.fm Course Review Notes
ing layer, which formation to the el.
shals the call and turns the results.
n Domain
oting Layer
te Object Server
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.c.4 Calling a Remote Object’s Methods• Client method calls resolve to the proxy object.
- The proxy object directs the call through the Remotmarshals the parameters and communicates all call inreceiving application domain through a defined chann
- On the object server side, the Remoting layer unmararguments, calls the method and then marshals and re
Application Domain
Remoting Layer
Applicatio
Rem
Channel
Client
Proxy
Remo
Page 13
cnRemoting.fm Course Review Notes
own Objectsl known to client), associating it with
ndle requests from e displayed in ultiple servers.
le each client call. ervice is to be a function, such as
d used to service
tiple calls, such as
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.d Implementing with .NET4.d.1 Types of .NET Remote Objects
• Server-Activated remote objects - also called Well Kn- The client must have a URL naming the object (wel- A server may create and register the remote object
either a TCP or HTTP channel for cummunication.• Two types of Server-Activated objects
- Singleton object - one object exists and is used to haall clients. Used when one client’s information may banother, such as a chat server. Hard to scale across m
- Single Call object - a new object is created to handUsed for stateless remote objects where an isolated sperformed for each client call. For example calculatingthe energy consumed by an air conditioner.
• Client-Activated objects - A single object is created anmultiple calls from a single client.- Used to retain client session information through mul
shopping cart applications.
Page 14
cnRemoting.fm Course Review Notes
emoting
e exposed to the
nterfaces or proxies ients.
on the appropriate or http) and remote
rvice) to register the
and are to be sor the lease
. Provide their user-
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.d.2 Developing an Application with .NET R• Server
- Define the server-side classes and methods that will binternet (published).
- Provide implementations of the classes and develop ithat isolate the server implementation classes from cl
• Registering the server-type- Based on the characteristics of the application, decide
deployment paradigm - communication platform (tcpobject type (Server-Activated or Client-Activated)
- Create a separate console application (or Windows Seserver channels and type(s)
• Consider server object lifetime - if leases are involvedmanually maintained, create a client application to spon
• Client- Define the client applications that will use the service
interface as well as connection to server code.
Page 15
cnRemoting.fm Course Review Notes
icate between the
ce. Use Http when ttp channels have TP makes
ormance benefit but nternet proxies.
channel Group Server:
through TCP with::8888/GrpSrv”)
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.d.3 Publishing a Server-Activated Singleton• Either (or both) HTTP and TCP can be used to commun
client and the server.- Http channels use SOAP and have slower performan
clients and server are located on different networks. Hspecific support for using proxies and SOAP over HTtraversing Internet proxies easier.
- Tcp channels use binary encoding which offers a perfis less likely to be succesfully transmitted across all I
• A single Application Domain may define more than one- For Example, publishing a server-activated singleton
TcpChannel tcpChan = new TcpChannel(8888);ChannelServices.RegisterChannel(tcpChan);HttpChannel httpChan = new HttpChannel(8889);ChannelServices.RegisterChannel(httpChan);RemotingConfiguration.RegisterWellKnowServiceType(typeof(GrpMgr),
“GrpSrv”,WellKnownObjectMode.Singleton)...
- A client may obtain a reference to the group managerGrpMgr gm=(GrpMgr)Activator.GetObject(typeof(GrpMgr),”tcp://localhost
Page 16
cnRemoting.fm Course Review Notes
y contacting the
emotingPencil.jar
pl.csver object
er.csdme.txtnd running the ated singleton and
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.d.4 Example Server-Activated Pencil Server• Suppose we have a pencil server. Clients share pencils b
server to borrow or return some number of pencils.• Here’s a jar file containing the entire example: dotNetR• Create the server implementation class as a library.
- See: PencilServerImpl.cs in the jar file. - msc /t:library /out:PencilServer.dll PencilServerIm
• Create an application to register and initiate a single ser- See: RegisterPencilServer.cs in the jar file. - msc /reference:PencilServer.dll RegisterPencilServ
• The example comes with an Ant build.xml file and rea- See the readme.txt file for instructions on building a
example. Note that this example includes server activsingle call as well as client activated (session).
Page 17
cnRemoting.fm Course Review Notes
Objectsr each method call.
e a new object.tion, the remote leton or single-call
e same as:
is initiated in the lls.
or.CreateInstance:ull,
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.d.5 SingleCall and Client-Activated Remote• Server-Activated SingleCall - Activates a new object fo
Client calls a method which initiates server to instantiat- The object is activated for a single call. Upon comple
object is released. Registration indicates the type singHttpChannel httpChan = new HttpChannel(8889);ChannelServices.RegisterChannel(httpChan);RemotingConfiguration.RegisterWellKnowServiceType( typeof(GroupMgr), “GroupServer”, WellKnownObjectMode.SingleCall)
- On the client side, obtaining an object may be done thChannelServices.RegisterChannel(new HttpClientChannel());GroupMgr gm = (GroupMgr)Activator.GetObject( typeof(GroupMgr), "http://localhost:8090/GroupServer");
• Client-Activated - Server registers the type; activation client. A single object instance serves all of a client’s ca
ChannelServices.RegisterChannel(new TcpServerChannel(8889));RemotingConfiguration.RegisterActivatedServiceType(typeof(GroupMgr));
- One way a client can create the object is using ActivatGroupMgr gm = (GroupMgr)Activator.CreateInstance(typeof(GroupMgr), n new object[] { new UrlAttribute(“tcp://localhost:8889”) } );
Page 18
cnRemoting.fm Course Review Notes
see:
ent-activated.
ext create two or ote that each client
of pencils.)hes the life-time of
compiles:pl.cser.cs
ilServer.dll in the y from the server.
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.d.6 Example Client-Activated PencilServer• Download the Ant project (same as the prior example),
dotNetRemotingPencil.jar- Follow the directions in the readme.txt file to run cli
• Differences and Observations:- Observe session functionality by starting the server. N
more clients in separate command prompt windows. Nhas its own remote server object (and its own supply
- The life-time of a client-activated remote object matcthe client’s remote reference to the server.
• Directly building the application requires the following- msc /t:library /out:PencilServer.dll PencilServerIm- msc /reference:PencilServer.dll RegisterPencilServ- msc /reference:PencilServer.dll PencilClient.cs- Attempting to deploy PencilClient.exe without Penc
folder will result in an attempt to download the librar
Page 19
cnRemoting.fm Course Review Notes
ecify L from a file.cts of the
d the application. GroupConfig.xml
jectUri=”GroupServer”/>
nfiguration with:
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.d.7 Configuration by XML• Instead of using method calls and their parameters to sp
RemotingConfiguration, it can be done by reading XM- Reading from an XML file allows for modifying aspe
configuration without having to recompile and rebuil- Suppose the Server-Activated configuration is in file:
<configuration> <system.runtime.remoting> <application> <service> <wellknown mode=”Singleton” type=”GroupMgr, GroupMgr” ob </service> <channels> <channel ref=”http” port=”8889”/> </channels> </application> </system.runtime.remoting></configuration>
- The server registration program could specify this coRemotingConfiguration.Configure(“GroupConfig.xml”);
Page 20
cnRemoting.fm Course Review Notes
ote Servers
active forever,
utes of inactivity.y calls a method on
verhead of network
time that is limited tialized to service a etes.
a Client-Activated
m calls the vice, which returns
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.e Lifetimes for Server-Activated Rem4.e.1 Lifetime of Remote Objects
• Client-Activated and Server-Activated objects aren’t unless explicitly specified this way by the developer.- Default idle period is 5 minutes. Released after 5 min- A new object is instantiated when a client subsequentl
the object.- Leases are used to manage lifetime, which avoids the o
wide reference counting of remote object references.
• Server-Activated SingleCall remote objects have a lifeto the duration of a single method call. The object is inisingle method call and released after the method compl
• How is the lifetime of a Server-Activated Singleton andremote object determined?- When a new instance is created, the Remoting Syste
MarshalByRefObject method InitializeLifetimeSeran object implementing ILease
Page 21
cnRemoting.fm Course Review Notes
rvice method to
bject) contains the s implementation nctionality.iated object will
will exist after a
ours of idle time till release method call extend 10 mins
figures the object
eSpan.Zero
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.e.2 Manually Controlling Leases• A Remote object can override the InitializeLifetimeSe
control aspects of the lease.- The remote server’s base class (MarshalByReference O
method InitializeLifetimeService. The remote server’can override this method to provide server-specific fu
- InitialLeaseTime determines how long a server-activexist when its initially registered.
- RenewOnCallTime determines how long the object client makes a method call.
public override object InitializeLifetimeService() { ILease myROLease = (ILease)base.InitializeLifetimeService(); if (myROLease.CurrentState == LeaseState.Initial){ myROLease.InitialLeaseTime = TimeSpan.FromHours(3); //initially 3 h myROLease.RenewOnCallTime = TimeSpan.FromMinutes(10); //after a } return myROLease;}
• Returning null or setting InitialLeaseTime to zero, conwith a never expiring lease.- For example: myROLease.InitialLeaseTime = Tim
Page 22
cnRemoting.fm Course Review Notes
.
ase expiration
ehalf of the remote
the service.
se expires. It returns extended.
bject class
nsor is used as an
opied to the server
separate client.
s.jar
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.e.3 Sponsoring a Lease• A client of a remote object can sponsor the objects lease
• Sponsors implement ISponsor and register interest in le
- The sponsor is a client that manages lease renewal on bobject.
ILease myROLease = (ILease)RemotingServices.GetLifetimeService(myRO);myROLease.Register(this); //this code may appear in a method that publishes
- the ISponsor.Renewal method is called before the leaa TimeSpan indicating how long the lease should be
• The sponsor must be a serializable or a MarshalByRefO
- When registering the sponsor with remoting, the Spoargument to a method in the Remoting Server.
- When the Sponsor is serializable, it is serialized and cand subsequently executed on the server.
- When the sponsor is a remote object, then it acts as a
- Example of a server registered with a lease: userParm
Page 23
cnRemoting.fm Course Review Notes
etersjectste Object Calls?
y/value, such as rshalling and
lByRefObjectrovide class lass must be ccess to the proxy.
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.f .NET Remoting Method Param4.f.1 Arguments and Returns for Remote Ob
• What are the valid parameter and return types for Remo- Primitive values, such as int and boolean.- .NET defined Serializable objects are passed by cop
String or Array classes. They are serialized upon madeserialized when unmarshalled.
- Remote objects. Classes that extend System.Marsha- User-Defined serializable or remote classes. Must p
information to the client. For serializable, the entire cavailable to the client. For remotes, the client needs a
Page 24
cnRemoting.fm Course Review Notes
arameter Typesation on groups of
erParms.jar
and their referencesng information n be seen by all.plications, such as
gr.dll
blic class RegisterGroupMgr{/neither serializable//nor remote
sterGroupMgr.exe
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.f.2 Remoting Example with User-Defined P• Consider the problem of representing and serving inform
people, such as Cst556, Faculty, and Students. See: us
• The diagram above shows assemblies in this application• Example with multiple clients accessing and manipulati
about groups of persons. Changes made by one client ca- Characteristic of a class of problems in distributed ap
email, listserves, and chatrooms.
GroupM
public class GroupMgr{ //remote}public class Group { //remote}GroupMgrClient.exe
public class GroupMgrClient { //neither serializable //nor remote}
pu / }
Regi
public class Person { //serializable}
public class SponsorGr { //serializable}
Person.dll
Page 25
cnRemoting.fm Course Review Notes
oting includes:k (GroupMgr).ut are not published.erson)
roupMgrClient ces GroupMgr.dll
serializable class as Person. By design, ass definition. They ss. For example,
ined classes as one on for user-defined stub promotes all ethods; Person’s
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.f.3 Comments on the GroupMgr Example• Implementation of this group application in .NET Rem
- Singleton object published in the remoting framewor- A number of remote Groups live in the application, b- Serialized objects are copied and passed to clients (P
• Constraint in deploying with .NET Remoting Clients. Gdoes not bind a Proxy for the remotes. Instead it referenand Person.dll libraries.- A distributed application may include a user-defined
a parameter or return from a Remote method, such as the client and the server may need access to the full clmay be designed to rely on methods of the shared claPerson’s Age property get and set methods.
- The soapsuds tool does not treat serializable user-defwould hope. Soapsuds generates a stub-class definitiserializable parameter (or return) types (Person). Theproperties to public visibility, and does not include mAge property get and set methods, for example.
Page 26
cnRemoting.fm Course Review Notes
ell know type. sponsor for
r managing groupsethod call) lease
gr object to manage
ept that the sponsor
vide a TimeSpanwhen you run the
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.f.4 Leases in GroupMgr Remoting Example• The example consists of three console applications
- RegisterGroupMgr - registers the GroupMgr as a wSponsorGroupMgr object is created as the renewal GroupMgr
- GroupMgrClient - provides a client user interface fo• Upon instantiation, GroupMgr sets its initial (and on m
times to 15 seconds. It also creates the SponsorGroupMits lease.- After 15 seconds of idle time, the object is released exc
has been registered to renew the lease.- Whenever the lease expires, Renewal is called to pro- Observe what happens to the state of defined groups
client without (comment out) the sponsor.- See: userParms.jar
Page 27
cnRemoting.fm Course Review Notes
e
mote object types? another machine
ponding names?
ations.
jects as parameters
es appear (client or ssed person they do?
rsion of required
g the library ant implementation solution?
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.f.5 Notes and Issues on GroupMgr Exampl
• Consider the following points related to the example
- How is name management handled for registered reCan a registered type be unregistered? Can a client onobtain a listing of all registered types and their corres
• Controlling where methods execute in distributed applic
- Serializable objects versus marshal-by-reference oband return values.
- Note the windows in which the two following messagserver): new group for myGroup created, and acceminiMe’s age property. Why do they appear where
• Using a proxy versus distributing the code or library veclasses:
- Note that the GroupMgr example builds clients usincontaining code for the server. Assuming we don’t wcode on the client, how could we better structure the
Page 28
cnRemoting.fm Course Review Notes
s.
singleton server
rvice each arriving ared data?
sses should be
read safe. Observe Group and ed synchronization read safe.
y way to allocate uests arrive? Object applications that
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.f.6 Threads and Thread-Safe Server Object• Server-activated singleton objects should be thread-safe
- What happens if multiple requests for method(s) in a object arrive at the same time?
- The remoting subsystem creates distinct threads to serequest. What is the implication on any underlying sh
- As a practical guideline, all marshal-by-reference clathread-safe.
• In the Group Manager example:
- The singleton GroupMgr object was not coded as ththat multiple threads (one for each client) can executeGroupMgr methods concurrently. There is no enforcof these threads. Good exercise to make the classes th
- For SingleCall server-activated remoting, is there anobjects from an existing pool of remote objects as reqpooling is a common approach to scaling the types ofSingleCall objects are intended to address.
Page 29
cnRemoting.fm Course Review Notes
ient
persistent state that
ssage servers.me aspect of the
the state, then all
plication.each client displays
splayed on all other
of the supply desk hange has occurred rver calls the client y.
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.g Call-Backs from Server to Cl4.g.1 The Problem
• Consider distributed applications where the server has amay be accessed and modified by multiple clients.- Characteristics of group-ware, email or threaded me- Multiple clients may be simultaneously displaying so
server’s current state.- If one client requests a server operation that modifies
other clients may display out-of-date information.• For example, consider the PencilServer supply desk ap
- Suppose clients are graphical user interfaces in which the current total of pencils in the supply desk.
- If one client adds pencils to the supply, then the total diclients will be out-of-date.
• Solution: The server acts as a client whenever the statechanges. It calls all active clients notifying them that a cin the supply desk (a modify event has occurred). The se(commonly called a callback) so it can update its displa
Page 30
cnRemoting.fm Course Review Notes
the Remote e server, such as terface includes a
ctivatable, or rtObject method to
encilModified.elegate with a llBackPencil.jar
er; also the private or each client call.as a listener; on exit t of listeners.
Distributed Applications for Windows © T. Lindquist 2019 February 2019
4.g.2 Solution Approach• In Java with RMI:
- The client becomes a remote object by implementinginterface. It also implements an interface known to thPencilChangeListener. The PencilChangeListener inmethod, such as notifyPencilSupplyChanged.
- The client either extends one of the remote classes (AUnicastRemoteObject) or it performs the static Expolet the RMI system know its a remote object.
• In C# .NET Remoting:- The server defines a public delegate, such as NotifyP- The client creates a delegate object, associating the d
method defined in the client. See example project: ca• In both the C# and Java solutions, the server:
- Implements methods: addListener and removeListenmethod callListener. CallListener creates a thread f
- In the client constructor, it calls the server to add itself the client calls the server to remove itself from the se
top related