[omniORB] Returning a cache sequence
Matthew Berry
mberry@mweb.co.za
Tue, 26 Jun 2001 18:03:24 +0200
Hi,
I have defined a structure Customer and an operation:
sequence<Customer> getCustomers()
Now when I initialise the "in-memory-database" server I read all the
customers into a sequence "cacheCustomers"
What I what to know is the most efficient way of returning (a copy of) the
customers in the above operation?
Option 1, using the sequence copy constructor:
return new CustomerSeq(cacheCustomers)
Option 2, using the data constructor (which H&V advises against, but I think
is more efficient):
return new CustomerSeq(cacheCustomers.length(), cacheCustomers.length(),
cacheCustomers.get_buffer(), 0)
Are both of these options thread-safe? Do I need to protect access to
"cacheCustomers", because I could potentially two clients requesting the
customer list simultaneously?
TiA,
Matthew