|
|
|
|||||
|
global variable and thread issue in ice
Hello,
I'm new to Ice. I want to store some aplication-wide variables in ice server application (this is reguler ice application, not using icebox / icegrid). I did this by placing those global variables in the main class of the object. So far so good for 1 client, but I wonder is this the correct way to do such thing ?. I mean, I'm afraid that every client will have their own fresh copy of server instance in separate thread instead of one instance of server object for all client. How ice server serve client's request, 1 instance for all clients or 1 instance (in separate thread) for 1 client ?. Thanks in advance for your help, regards, solikhin |
|
||||||
|
Hi,
I assume you meant "servant" by "main class of the object" (see this FAQ for the correct terminology). It's not quite clear to me what you're doing (perhaps you can post some sample code to demonstrate it?). But if you have registered the servant with the object adapter and your clients invoke on the Ice object incarnated by the servant with a proxy that only points to this Ice object, your clients will use the same instance of the object. Cheers, Benoit. |
|
|||||
|
re:global variable and thread issue in ice
Thanks for your quick reply,
Here is an ilustration on what I mean with "the main class of the object" : class HelloI : public Demo::Hello { public: virtual void sayHello(int delay,const Ice::current&) const; virtual void shutdown(const Ice::current&); // Here I put some global variables // ie: some connection to the "in memory" database } Those variables will be initialized during the creation of those class. I expect to only have 1 instance of this class (regardless of the number of client connection) so that the content of in memory database will be consistent on all client. Is that the correct way to do such thing ?. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| patch #3 for Ice 3.2: Fix for condition variable implementation under Windows. | matthew | Patches | 3 | 08-13-2008 03:35 PM |
| Java global package metadata and builtin datatypes | mefoster | Bug Reports | 1 | 05-11-2007 12:27 PM |
| visual Studio & ice 3.0 & Global Assembly Cache | loheron | Help Center | 7 | 11-23-2006 08:39 AM |
| IcePy and The global interpreter lock | rc_hz | Comments | 1 | 10-17-2006 10:50 AM |
| Question about ICE_CONFIG environment variable in Ice for java ? | rc_hz | Comments | 2 | 09-18-2006 06:54 AM |