This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
at:tutorial:distribution [2009/01/29 10:31] elisag |
at:tutorial:distribution [2009/01/30 16:13] (current) tvcutsem *fixed |
||
---|---|---|---|
Line 19: | Line 19: | ||
</ | </ | ||
- | ===== Exporting and discovering objects | + | ===== Exporting and Discovering Objects |
AmbientTalk provides language support to make some objects available to other objects residing in remote actors by means of the '' | AmbientTalk provides language support to make some objects available to other objects residing in remote actors by means of the '' | ||
Line 72: | Line 72: | ||
- Native data types are always passed by copy. | - Native data types are always passed by copy. | ||
- | When a remote far reference receives a messages, it flushes the message to the remote object providing that it is connected. If the remote far reference is disconnected, | + | When a remote far reference receives a message, it flushes the message to the remote object providing that it is connected. If the remote far reference is disconnected, |
- | Therefore, a remote far reference | + | Therefore, a remote far reference |
< | < | ||
Line 88: | Line 88: | ||
</ | </ | ||
- | This code illustrate | + | This code illustrates |
- | In order to cope with partial failures, AmbientTalk also allows developers to retract all currently unsent messages from the remote far reference outbox by means of the '' | + | In order to cope with partial failures, AmbientTalk also allows developers to retract all currently unsent messages from the remote far reference outbox by means of the '' |
- | The '' | + | The '' |
< | < | ||
Line 102: | Line 102: | ||
</ | </ | ||
- | The construct | + | The '' |
The function '' | The function '' | ||
Line 108: | Line 108: | ||
===== Dealing with Permanent Failures ===== | ===== Dealing with Permanent Failures ===== | ||
- | As explained in the previous section, remote far references have been designed to be resilient to intermittent disconnections by default. This behaviour is desirable because it can be expected that many partial failures in mobile ad hoc networks are the result of transient network partitions. However, not all network partitions are transient. For example, a remote device has crashed or has moved out of the wireless communication range and does not return. Such permanent failures should also be dealt by means of compensating actions, e.g. application-level failure handling code. | + | As explained in the previous section, remote far references have been designed to be resilient to intermittent disconnections by default. This behaviour is desirable because it can be expected that many partial failures in mobile ad hoc networks are the result of transient network partitions. However, not all network partitions are transient. For example, a remote device has crashed or has moved out of the wireless communication range and does not return. Such permanent failures should also be dealt with by means of compensating actions, e.g. application-level failure handling code. |
- | To deal with permanent failures, AmbientTalk uses the concept of leasing. A lease denotes the right to access a resource for a specific duration that is negotiated by the owner of a resource and a resource claimant (called the lease grantor and lease holder, respectively) when the access is first requested. | + | To deal with permanent failures, AmbientTalk uses the concept of leasing. A lease denotes the right to access a resource for a specific duration that is negotiated by the owner of a resource and a resource claimant (called the lease grantor and lease holder, respectively) when the access is first requested. At the discretion of the lease grantor a lease can be renewed, prolonging access to the resource. In AmbientTalk, |
====Leased Object References==== | ====Leased Object References==== | ||
- | A leased object reference is a remote far reference that grants access to a remote object for a limited period of time. When the time period has elapsed, the access to the remote object is terminated and the leased reference is said to //expire//. Similarly to remote far references, a leased reference abstracts client objects from the actual network connection state. Client objects can send a message to the remote object even if a leased | + | A leased object reference is a remote far reference that grants access to a remote object for a limited period of time. When the time period has elapsed, the access to the remote object is terminated and the leased reference is said to //expire//. Similarly to remote far references, a leased reference abstracts client objects from the actual network connection state. Client objects can send a message to the remote object even if a leased |
- | {{ : | + | {{ : |
====Working with leased object references==== | ====Working with leased object references==== | ||
Line 221: | Line 221: | ||
====Importing leased object references==== | ====Importing leased object references==== | ||
- | Similar to futures, leased object references have been built reflectively on top of AmbientTalk. | + | Similar to futures, leased object references have been built reflectively on top of AmbientTalk. |
To use the language constructs for leased references, you should import the leasedref module as follows: | To use the language constructs for leased references, you should import the leasedref module as follows: | ||
- | import /.at.lang.leasedref; | + | < |
- | + | import /.at.lang.leasedrefs; | |
- | < | + | </ |
- | leasedref | + | < |
+ | leasedrefs | ||
</ | </ | ||
- | More information pertaining to the API of the leased references language module can be found in the appendix. | + | More information pertaining to the API of the leased references language module can be found in the [[appendix|appendix]]. |
- | ===== Garbage collecting remote references | + | ===== Taking Offline Remote Objects |
- | < | + | AmbientTalk distributed memory management scheme has been based on [[http:// |
- | Under Construction: | + | |
- | Update this section | + | |
- | </note> | + | |
- | As explained in the previous section, AmbientTalk' | + | As previously |
< | < | ||
Line 245: | Line 243: | ||
</ | </ | ||
- | The construct removes | + | The primitive takes as parameter an object which is removed |
- | + | ||
- | < | + | < |
- | As you may have noticed, | + | [[distribution# |
</ | </ | ||
- | On the client side, taking offline an object results in a permanent disconnection of the remote references pointing to it. In other words, despite having network connection, unexporting an object renders remote far references permanently disconnected. This implies that client have to deal explicitly with unexported objects. | + | ====Working with objects taken offline==== |
+ | |||
+ | On the client side, taking offline an object results in a permanent disconnection of the remote | ||
+ | |||
+ | Clients can get notified when an object is taken offline by means of '' | ||
+ | |||
+ | Additionally, | ||
< | < | ||
Line 260: | Line 264: | ||
</ | </ | ||
- | Be aware that unexporting a object will not only trigger | + | The construct takes as parameter a far reference and a block of code that is executed when the taken offline event is notified |
- | + | ||
- | Note that disconnection, | + | |
< | < | ||
- | The complete implementation of the instant messenger application explained along this chapter | + | Disconnection, |
</ | </ | ||
+ | |||
+ | ====Distributed unit testing and takeOffline==== | ||
+ | |||
+ | As previously mentioned, the '' | ||
+ | |||
+ | These semantics is useful for unit test purposes. The [[appendix# | ||
+ | |||
+ | By means of the '' |