PROCEDURE SwapHandlers (deactivationList : REF ARRAY OF Binding;
activationList : REF ARRAY OF Binding)
RAISES { Error };
PROCEDURE GetHandlers (event: PROCANY;
module : RTCode.Module): REF ARRAY OF Binding
RAISES { Error };
PROCEDURE IsInstalled (binding: Binding): BOOLEAN;
PROCEDURE GetOriginalHandler (event: PROCANY): Binding
RAISES { Error };
GetHandlers allows returns a list of bindings installed on a particular event.
GetOriginalHandler returns the original handler of an event, i.e., the procedure implementing it. The identity of the original handler is necessary of the original handler's properties should be changed, for example, to become the default handler or to be uninstalled.
IsInstalled allows checking whether a binding is active or not.
MODULE S1;
PROCEDURE A (...) = BEGIN ... END A;
PROCEDURE B (...) = BEGIN ... END B;
PROCEDURE C (...) = BEGIN ... END C;
VAR
oldVersion : Service;
oldHandlers : REF ARRAY OF Dispatcher.Binding;
newHandlers : REF ARRAY OF Dispatcher.Binding;
BEGIN
(* get the old handlers *)
oldVersion := NameServer.Get("ServiceName");
oldHandlers := oldVersion.GetHandlers();
(* create new handlers *)
newHandlers := NEW(REF ARRAY OF Dispatcher.Binding, 3);
newHandlers[0] := Dispatcher.Create(A.E, NIL, A);
newHandlers[1] := Dispatcher.Create(B.E, NIL, B);
newHandlers[2] := Dispatcher.Create(C.E, NIL, C);
(* swap them atomically *)
Dispatcher.SwapHandlers(oldHandlers, newHandlers);
END S1;
Przemek Pardyak,