%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Generic client/server % The client/server tool consists of two filed: dserver.oz and % dclient.oz. % The implementation is done completely within the distributed % computation model using the Fault module. It uses several % techniques that can be reused by a sophisticated developer wishing % to develop other generic abstractions. The tool consists of two % functors, dclient.oz and dserver.oz. Both functors use a utility % procedure, Guard, which is used to execute a statement in protected % fashion. Invoking {Guard X [permFail] S1 S2} will execute S1 unless % there is a permFail on entity X, in which case the execution of S1 % is aborted and S2 is executed instead. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % The contents of dserver.oz % Authors: Peter Van Roy and Seif Haridi % May 9, 2003 functor import Application Connection Module Pickle Fault Guard define Args={Application.getArgs record('in'(single type:string) publish(single type:string))} [Server]={Module.link [Args.'in']} Q=Server.server S P {NewPort S P} {Pickle.save {Connection.offerUnlimited P} Args.publish} thread {ForAll S proc {$ M#Sync} SL in try {Q M} SL=unit catch X then SL=X end {Guard.guard Sync [permFail] proc {$} Sync=SL end proc {$} skip end} end} end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%