at:tutorial:distribution
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
at:tutorial:distribution [2009/01/29 10:31] – elisag | at:tutorial:distribution [2009/01/29 15:19] – elisag | ||
---|---|---|---|
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. | ||
- | ===== Garbage collecting | + | ===== Taking offline |
- | < | + | 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, | + | Leased object references make use of the '' |
</ | </ | ||
- | 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, | ||
- | < | ||
when: messenger takenOffline: | when: messenger takenOffline: | ||
system.println(" | system.println(" | ||
//clean certain resources associated to the buddy | //clean certain resources associated to the buddy | ||
}; | }; | ||
- | </ | ||
- | Be aware that unexporting a object will not only trigger the takenOffline observers but also the disconnected observers since the taking offline event is also considered as a logical disconnection between two devices. Unlike the network observers, the block of code of a takenOffline observer will be triggered only once. The remote object becomes then subject to be eventually reclaimed by the garbage collector. As a result, the disconnected and reconnected observers will be no longer trigger for such remote reference. | ||
- | Note that disconnection, | + | The construct takes as parameter a far reference and a block of code that is executed when the taken offline event is notified to the virtual machine. '' |
+ | |||
+ | < | ||
+ | Disconnection, reconnection and takenOffline observers can be also installed for the inter-actor far references. Such inter-actor far references are local to a virtual machine and as such, network failures cannot happen. In that case, the disconnected | ||
+ | </ | ||
+ | |||
+ | ====Distributed unit testing and '' | ||
+ | |||
+ | As previously mentioned, the '' | ||
+ | This semantics are useful for unit test purposes. The unit testing framework shipped with AmbinentTalk has support to perform asynchronous invocations which can be used to perform concurrent or distributed unit tests. However, distributed unit tests couldn' | ||
< | < | ||
The complete implementation of the instant messenger application explained along this chapter can be found in the file '' | The complete implementation of the instant messenger application explained along this chapter can be found in the file '' | ||
</ | </ |
at/tutorial/distribution.txt · Last modified: 2009/01/30 16:13 by tvcutsem