[Date Prev][Date Next] [Chronological] [Thread] [Top]

classes





Hi,



I'm currently experementing JoCaml as a target language for a compiler
that my team is developping (it is an actor-based functional language).

As I feel more at ease with programming classes and objects than
automata, I'm designing my system with the OO features of JoCaml. 

But, I face a behavior which seems strange to me (or, say, unexpected).
I've got 2 programs: a server and a client. The server is implement as
an object, it manages the connections from clients. The client program
is just an object too, connecting to the server. Of course, there may be
several clients. The server registers itself to the NS (jocns):

let _ =
  let jserver = new jserver () in
  Ns.register "jserver" jserver vartype;
  Join.server ()

Note that the server contains a method [notify_site] that prints "***
new container process connected" after each new client connection.


Then, each client looks up the server, and tries to connect to it:

let _ =
  let manager = Ns.lookup "jserver" (vartype : jserver metatype) in
  print_string "### connecting to the manager..."; flush stdout;
  manager#notify_site Join.here; 
  print_endline "connected"; flush stdout;
  Join.server ()


However, after running jocns and my server, here is what happens when
I'm running a client:

Querying name server shiva:20001
### connecting to the manager...*** new container process connected
connected

As you can see, all the printings are done in the client's console,
while I expected the server's printing to appear in its own console.
I'm surprised because, as far as I understand, objects are in fact
implemented as mobile instances of automatas. So they shouldn't migrate,
unless I explicitely ask for it. The method calls should be kind of RPC.
But here, it seems that the server migrates to the client, then does its
job. Well, this is what I understand...

Can anyone explain?

Thanks,

dc


-- 
David Chemouil [mailto:chemouil@enseeiht.fr] [mobile: 06 84 16 26 65]

Laboratoire d'informatique et de mathématiques appliquées (IRIT-INPT)