• Keine Ergebnisse gefunden

Exercise3DistributedProgrammingwithRMI Exercise2ThermoControlSystemUsingSynchronousMessages Exercise1JCoBox-Chatsystem PracticeSheet11(HintsandComments) AdvancedAspectsofObject-OrientedProgramming(SS2015)

N/A
N/A
Protected

Academic year: 2022

Aktie "Exercise3DistributedProgrammingwithRMI Exercise2ThermoControlSystemUsingSynchronousMessages Exercise1JCoBox-Chatsystem PracticeSheet11(HintsandComments) AdvancedAspectsofObject-OrientedProgramming(SS2015)"

Copied!
1
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Prof. Dr. A. Poetzsch-Heffter Mathias Weber, M.Sc.

University of Kaiserslautern Department of Computer Science Software Technology Group

Advanced Aspects of Object-Oriented Programming (SS 2015) Practice Sheet 11 (Hints and Comments)

Exercise 1 JCoBox-Chatsystem

See provided sources. Note, that no explicit synchronization is needed, in contrast to the multi-thread version of Exercise 10.

Exercise 2 ThermoControl System Using Synchronous Messages

See provided source.

Exercise 3 Distributed Programming with RMI

a) According to the W3C:A Web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL).

Other systems interact with the Web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.

RMI is directly supported by the language and uses real java-objects as parameters and message receivers. With some exceptions they behave like standard objects, whereas a webservice uses its own message format and it transfers messages not objects. Webservices cannot provide callbacks, because they don’t have access to the object system. Additionally, RMI is type safe by design whereas webservices interact using XML which first has to be deserialized into Java objects to be type safe.

b) A scenario would be a producer consumer system, where the client acts as a producer and sends the server a reference to the produced object. The server can than use this remote-reference to retrieve information about the produced object.

An RMI server exports a remote object to a stub. This stub is than registered at the RMI registry, such that the client can retrieve a stub that is connected to the corresponding object on the server. The client than creates an instance of a remote object and also exports it to a stub. The client can now use the server-object-stub to call a method on the server object and pass the client-object stub as a parameter. The server can than use the client-object-stub to perform a callback on the client.

c) As remote objects are not copied during transfer, the usage of a remote object as parameter or return value exposes the remote object, even if it has not been registered before. The name service only serves as a central repository to find objects by their name, it has to be used to establish the first connection between two machines. After that, references to remote objects may be passed freely around.

Referenzen

ÄHNLICHE DOKUMENTE

// invariant : either all components are visible or all are hidden. Capturing occurs if a reference, which was passed as a parameter to a method, is stored in a field of the

– Enforces “Think before you code”. The developer has to think about the precise meaning of the inter- faces he uses, this allows to detect errors and problem quite early in

Starting a method-specification with the keyword also is intended to tell the reader that this specification is in addition to some specifications of the method that are given in

false. This does not guarantee that there exists only a single instance of the field for all threads of the program. In the Java memory model, every thread has its own instance of

a) Write a server that handles multiple clients and accepts new clients at any time. All messages send by any client shall immediately be displayed at all clients. Prefix messages

Typically, the interface between the worker and the GUI is very broad: The process() method, which is part of the worker and updates the state of the GUI, will access most of

When an RMI server object is exported, the runtime system (Java virtual machine) creates a dynamic proxy (RMI stub) that implements the respective remote interface, and forwards

public class ServerImpl extends UnicastRemoteObject implements Server { public ServerImpl throws RemoteException