• Keine Ergebnisse gefunden

Exercise3Swing Exercise2RMI-Chatsystem Exercise1DistributedProgrammingwithRMI PracticeSheet12(HintsandComments) AdvancedAspectsofObject-OrientedProgramming(SS2013)

N/A
N/A
Protected

Academic year: 2022

Aktie "Exercise3Swing Exercise2RMI-Chatsystem Exercise1DistributedProgrammingwithRMI PracticeSheet12(HintsandComments) AdvancedAspectsofObject-OrientedProgramming(SS2013)"

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 2013) Practice Sheet 12 (Hints and Comments)

Exercise 1 Distributed Programming with RMI

a) -

b) In general callbacks are supported, but as RMI copies non-remote objects to the remote side, it is difficult to see whether a callback will occur or not. Direct callbacks can only occur if the first object is also a remote object, but indirect callbacks can occur if the controlflow passes via another remoteobject back to the first object.

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.

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.

Exercise 2 RMI-Chatsystem

See provided sources.

Exercise 3 Swing

a) See provided sources.

b) The execution of aSwingWorkerinvolves three threads:

• Current thread: Theexecute()method is called on this thread.

• Worker thread: ThedoInBackgroud()method is called on this thread.

• Event Dispatch Thread: All Swing related activities occur on this thread. Specifically, the methodsprocess()

anddone()are invoked on this thread.

Typically, the interface between the worker and the GUI is very broad: Theprocess()method, which is part of the worker and updates the state of the GUI, will access most of the elements of the GUI directly. Great care has to be taken that this access is thread-safe. Thread-safety can be accomblished by relocating all access to the GUI elements to the Event Dispatch Thread usingSwingUtilities.invokeLaterorSwingUtilities.invokeAndWaitor the

processanddonemethods ofSwingWorkers.

Referenzen

ÄHNLICHE DOKUMENTE

// @ public model instance JMLObjectSequence elements ; // @ initially elements != null && elements.. c) The method implementation are straightforward, mainly delegate the

a) Implement a method IPlugin load(String clazz) that loads the plugin with the given name. Please also check that the loaded class really implements the needed interface.. b)

C was declared final, so there cannot be any subclasses of C and m was declared protected, therefore the only code that can call m is inside p, the change of the parameter type is

Does the print method in class PhDAssistant override the print method in class Person ? Hint: look at the Java Language Specification in Section 8.4.8... Exercise

Since the example program neither uses synchronized blocks nor volatile fields, the value the main threads sets is never synchronized with the background thread. The example can

But now multiple thread can be concurrently in the Map implementation, in order to guar- antee mutual exclusive access for a thread, we have to protect all possible concurrent

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

in JCoBox it is guaranteed, that if an object a of CoBox a sends two messages to objects in another CoBox, these messages will be handled in the same order as they have been send,