6).
Notice that this feature has no state variables of its own. It is a dependent feature
of the credits feature model program. We could also have annotated the credits
feature model program in Figure 14.1 directly, but it is useful to keep the dependent
feature separate for readability and for later use in compositions. In some cases the
dependent feature is not needed and can be omitted.
Advanced Topics 231
namespace SP
{
[Feature]
class MessageParameters
{
[Action("ResSetup(m,c,_)")]
[Action("ResWork(m,c,_)")]
static void Res([Domain("M")]int m, [Domain("C")]int c){}
static Set
M() { return Credits.requests.Keys; }
static Set C()
{
if (Credits.requests.Values.IsEmpty)
return Set.EmptySet;
else{
int maxCredits = Credits.requests.Values.Minimum();
Set res = Set.EmptySet;
for (int c = 0; c <= maxCredits; c++) res = res.Add(c);
return res;
}
}
[Action("ReqSetup(m,_)")]
[Action("ReqWork(m,_)")]
static void Req([Domain("ReqM")]int m){}
static Set ReqM() { return Credits.window; }
[Action]
static void Cancel([Domain("CancelM")]int m) { }
static Set CancelM() { return Credits.requests.Keys; }
}
}
Figure 14.6. Message parameters.
14.2.3 Cancellation feature
The cancellation feature of the protocol enables the client to cancel requests that
have been sent to the server. In order to cancel a previously sent request with message
ID k, the client sends a Cancel request to the server that identifies the request to be
cancelled by including the ID k in the message.
Pages:
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309