
Hi Ceriel, Quoting [Ceriel Jacobs] (Oct 30 2007):
Andre Merzky wrote:
Thanks, that is a good catch - I fixed that in CVS.
It think, however, that the issue on remove_metric is reversed: IncorrectState does not make sense on the metric.remove_callback(), as that should be possible on a final metric.
So I removed added IncorrectState to monitorable.add_callbacj, and removed it from metric.remove_callback. Does that make sense for you?
So metric.remove_callback on a final metric always gives DoesNotExist? (You cannot add callbacks to a final metric, so the metric cannot have callbacks).
A metric can become final during their lifetime, so a callback may have been added earlier. For example, the job.state metric will get final when the job enters a final state. So, if you have the following: saga::job j = js.create_job (jd); saga::metric m = job.get_metric ("job.state"); int cookie = m.add_callback (my_cb); // cb prints "New" j.run (); // cb prints "Running" j.wait (); // cb prints "Done" // metric is final now, so the cb will never be invoked // again - but the cb should still be removable, i.e. in // order to release shared resources hold by the cb. m.remove_callback (cookie); In this case, no exception is thrown. Yes, a DoesNotExist exception would be thrown if, for example, the cookie is used twice for removal - but a IncorrectState exception would make no sense, IMHO. Cheers, Andre.
Ceriel
-- No trees were destroyed in the sending of this message, however, a significant number of electrons were terribly inconvenienced.