Home Help Center

All client share common data?

eaglecneaglecn Member Yong WANGOrganization: ICT,chinaProject: DBroker
I am trying to implement multi-users to access service on single server,The interface is as following:
MQueryI
{
.......
resultset *rs; //store handle of result;
.......
release();
}

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;
So:
Are all client share data define in the interface? if so, how can I implement multi-user to run with it's own data?

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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!

    Benoit.
  • eaglecneaglecn Member Yong WANGOrganization: ICT,chinaProject: DBroker
    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?
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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.

    Benoit.
  • eaglecneaglecn Member Yong WANGOrganization: ICT,chinaProject: DBroker
    Thank you very much, I will try them both.
Sign In or Register to comment.