Hi, I tried the code you gave me and it worked the way I wanted it to. I really appreciate your help.
2012/2/27 Yves Jaradin <[email protected]> > Le 27/02/12 14:21, Khadija EL MAHRSI a écrit : > >> Hi, >> I'm trying to create a distributed system with "central" log files. By >> "central" I mean that the log files are to be created on one machine >> only while the remote elements of the system access the log files on >> this machine and write in them. Is it possible to achieve this? >> >> Thanks >> >> >> ______________________________**______________________________** >> _____________________ >> mozart-users mailing list >> [email protected] >> http://www.mozart-oz.org/**mailman/listinfo/mozart-users<http://www.mozart-oz.org/mailman/listinfo/mozart-users> >> > > Hello, > > Quite easily. Here is a function that takes a class and returns a class > with the same behaviour except that the code will run on the machine where > the function was called. By doing RemoteFile={MakeRemoteClass Open.file}, > you should be able to distribute RemoteFile and use it as Open.file except > the file will be read and written on the machine that created RemoteFile. > It should also be possible to use something more specific to the case at > hand... > > Be careful that I didn't test this code thoroughly. > > Yves > > fun{MakeRemoteClass K} > MasterPort={NewPort thread > for R#I#D in $ do Obj in > thread > try > Obj={New K I} > D=unit > catch E then > D={Value.failed E} > end > end > R={NewPort > thread > for M#D in $ do > thread > try > {Obj M} > D=unit > catch E then > D={Value.failed E} > end > end > end > end} > end > end} > in > class > attr remotePort:unit > meth otherwise(M) O N D in > O=remotePort:=N > if O==unit then > {Send MasterPort N#M#D} > else > N=O > {Send O M#D} > end > {Wait D} > end > end > end > ______________________________**______________________________** > _____________________ > mozart-users mailing list > [email protected] > http://www.mozart-oz.org/**mailman/listinfo/mozart-users<http://www.mozart-oz.org/mailman/listinfo/mozart-users> >
_________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
