User Tools

Site Tools


at:tutorial:distribution

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
at:tutorial:distribution [2009/01/28 17:51] elisagat:tutorial:distribution [2009/01/29 10:30] elisag
Line 134: Line 134:
 </code> </code>
  
-The ''lease:for:'' construct takes as parameters a time interval (in milliseconds) and the remote object to which it grants access, and returns a leased far reference that remains valid for the indicated time interval (5 minutes in the example). The construct alters the parameter passing semantics of the remote object to which it grants access, which gets parameter passed by lease rather than the default by far reference semantics. +The ''lease:for:'' construct takes as parameters a time interval (in milliseconds) and the remote object to which it grants access, and returns a leased reference that remains valid for the indicated time interval (5 minutes in the example). The construct alters the parameter passing semantics of the remote object to which it grants access, which gets parameter passed by lease rather than the default by far reference semantics. 
  
 <note> <note>
-We are assume the use of futures to get the return value of the ''openSession'' asynchronous message invocation. For further details about futures, we refer the reader to the previous chapter on the [[actors|concurrency model of AmbientTalk]].+We assume the use of futures to get the return value of the ''openSession'' asynchronous message invocation. For further details about futures, we refer the reader to the previous chapter on the [[actors|concurrency model of AmbientTalk]].
 </note> </note>
  
Line 161: Line 161:
 <code> <code>
 when: mySession expired: {  when: mySession expired: { 
-... // free up resources used by this session+... // free up resources used by this session e.g. the cart
  
 </code> </code>
Line 168: Line 168:
  
 ====Leasing patterns==== ====Leasing patterns====
- 
 As is the case in other leasing mechanisms, determining the proper lease renewal period is not straightforward and may even depend on system parameters such as the number of clients. In AmbientTalk, we incorporate two leasing variants on leased object references which transparently adapt their lease period under certain circumstances.  As is the case in other leasing mechanisms, determining the proper lease renewal period is not straightforward and may even depend on system parameters such as the number of clients. In AmbientTalk, we incorporate two leasing variants on leased object references which transparently adapt their lease period under certain circumstances. 
  
-The first variant is a renew-on-call leased reference which automatically prolongs the lease upon each method call received  +The first variant is a //renew-on-call// leased reference which automatically prolongs the lease upon each method call received  
-by the remote object. In other words, as long as the client uses the remote object, the leased reference is transparently renewed by the interpreter.  In the context of the shopping application example,  once a client establishes a shopping session with the server, the session should remain active as long as the shopping process is active, i.e. addItemToCart or checkOutCart messages are received in the session object. A renew-on-call leased reference can be used for the session object to model that kind of collaboration as follows:+by the remote object. In other words, as long as the client uses the remote object, the leased reference is transparently renewed by the interpreter.  In the the shopping application example,  once a client establishes a shopping session with the server, the session should remain active as long as the shopping process is active, i.e. ''addItemToCart'' or ''checkOutCart'' messages are received in the session object. A renew-on-call leased reference can be used for the session object to model that kind of collaboration as follows:
  
 <code> <code>
Line 186: Line 185:
 </code> </code>
  
-Similar to lease:for: , this construct takes as parameters a time interval (in milliseconds) and the remote object to which it grants access, and returns a leased far reference that remains initially valid for 5 minutes but it is automatically renewed each time the remote object receives a message. The renewal time applied on every call is the initial interval of time specified at creation by default. +Similar to ''lease:for:'', this construct takes as parameters a time interval (in milliseconds) and the remote object to which it grants access, and returns a leased reference that remains initially valid for 5 minutes but it is automatically renewed each time the remote object receives a message. The renewal time applied on every call is the initial interval of time specified at creation by default. 
  
-The second variant is a single-call leased reference which automatically revokes the lease upon performing a successful method call on the remote object.  The singleCallLease:for: construct allows developers to create single-call leased references as follows:+The second variant is a //single-call// leased reference which automatically revokes the lease upon performing a successful method call on the remote object.  The ''singleCallLease:for:'' construct allows developers to create single-call leased references as follows:
  
 <code> <code>
Line 197: Line 196:
 </code> </code>
  
-Similar to its other two counterparts this construct takes as parameters a time interval (in milliseconds) and the remote object to which it grants access, and returns a leased far reference that remains valid for only a single call. In other words, the leased reference  +Similar to the other two constructs''singleCallLease:for:'' takes as parameters a time interval (in milliseconds) and the remote object to which it grants access, and returns a leased reference that remains valid for only a single call. In other words, the leased reference expires after the remote object receives a single message. However, if no message has been received within the specified time interval, the leased reference also expires. 
-expires after the remote object receives a single message. However, if no message has been received within the specified time interval, the leased reference also expires. +
  
 ====Integrating leasing with future-type message passing==== ====Integrating leasing with future-type message passing====
at/tutorial/distribution.txt · Last modified: 2009/01/30 16:13 by tvcutsem