[omniORB] Concurrent access to CORBA objects

Duncan Grisby duncan@grisby.org
Fri Jul 26 11:41:01 2002


On Monday 22 July, Alexander Deruwe wrote:

[...]
> This would give me 1 object in the server on which the methods
> set_code(), set_name() and new() can be called. If there are two
> connections to this object, they will be working on the same values
> (correct?); what is the preferred way to work around this? Threading
> with locking? I am quite new to this subject, so I would appreciate any
> insight you guys can give.

Yes, if you give two clients references to the same object, they can
both access it at the same time. This isn't an issue to "work around"
-- for many applications it is exactly what you want. If it isn't what
you want, you should do something else. It isn't obvious to me what
you are trying to achieve. Can you explain?

> For the record, I am now doing the following for database access:
> 
> ..<snip>..
> struct data_s
> {
>     string code;
>     string name;
> };
> typedef sequence<data_s> data;
> 
> interface SampleInterface
> {
>     boolean new(in data d);
> };
> ..<snip>..
> 
> Is this the way I should implement what I'm doing?

It's impossible to answer that without knowing more about what you are
trying to do. In general, defining complex data structures in IDL is a
sensible thing to do for many applications. For others, you need a
more dynamic approach using the Any type.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan@grisby.org     --
   -- http://www.grisby.org --