This forum has been archived. Please start a new discussion on GitHub.

All client share common data?

I am trying to implement multi-users to access service on single server,The interface is as following:
resultset *rs; //store handle of result;

running mode:
rs get a result set and release the corresponding space when call release().
single client runs normally,but when multi-users run, segment fault in release();
printout the address of rs in release, find: all the same for all users;
Are all client share data define in the interface? if so, how can I implement multi-user to run with it's own data?


  • benoit
    benoit Rennes, France
    If your clients are talking to the same Ice object they will view and eventually modify the same state. You will need to create one instance (i.e.: an Ice object) of your interface per client if you want each client to access a different state. You could use the well-know factory design pattern to create these objects.

    Hope this helps!

  • thanks!
    I have to encapsulate some complex data in client-related interface. For example, to keep a resultset up to 1.5GB, is object factory efficient?

    consider another schema,server new only one interface, once a client reaches, generate a data area for this client and it's unique context.then client using this context access service and operate on its' own data.

    so,under this circumstance,which schema is better?
  • benoit
    benoit Rennes, France
    The factory pattern is a design concept, I can't really tell you if it's efficient or not, it depends on the implementation :). As for your second suggestion, you might be able to use Ice contexts (see the Ice manual for more information) to achieve what you want but I think it would be cleaner to do this at the interface level.

    You might also want to look at our first newsletter, it discusses session management with Glacier2. You could also use client sessions to keep the specific client data.

  • Thank you very much, I will try them both.