[Opensource] Time to initialize dbobject
BSC
bsci at lycos.com
Fri Jun 7 16:10:02 PDT 2002
Makes perfect sense. Thx.
---
Aime
On Fri, 07 Jun 2002 12:31:21
Michael Rimov wrote:
>At 09:09 PM 6/6/2002 -0500, you wrote:
>>On Thu, 06 Jun 2002 10:54:52
>> Michael Rimov wrote:
>> >At 09:08 AM 6/6/2002 +0200, you wrote:
>>
>>(snip)
>>
>> >Thirdly, DBObjects themselves are not truly threadsafe [Although the
>> >function to get the value from the cache is, the rest of it isn't.]
>>
>>DBObjects are not threadsafe?? Are you saying that using DBObjects from a
>>servlet environment could cause database corruption or other problems?
>
>Not at all! Sorry for the misunderstanding! But if you think about it a
>threadsafe object is only necessary if:
>
>1 - The object is actually shared between server requests
>
>or
>
>2 - The object is specifically shared between two threads without explicit
>queues.
>
>
>In this case, a DBObject is traditionally retrieved by a single
>request. Therefore, inter-thread sharing is not truly really necessary.
>
>The ONE case where a DBObject is shared across threads is through the
>dbobject cache. Access to the DBObjects through the cache IS
>threadsafe. Thus you won't be corrupting anything in the database. In
>fact my own test takes about 30 threads and works with the underlying
>database as a test case. If that helps to ease your mind.
>
>Why I say not threadsafe, is that right now an instantiated DBObject is not
>intended to be shared except through the system cache. You could easily
>create a wrapper object where all methods to the object are synchronized,
>and you would be fine.
>
>It gives us a LARGE performance boost by working things that way, and still
>allows DBObjects to be used in the way they typically are through a normal
>servlet request.
>
>Does this make sense? Am I babbling? Let me know! :)
>
> -Mike
>
>
>_______________________________________________
>Opensource mailing list
>Opensource at jcorporate.com
>http://mail.jcorporate.com/mailman/listinfo/opensource
>Archives: http://mail.jcorporate.com/pipermail/opensource/
>
_______________________________________________________
WIN a first class trip to Hawaii. Live like the King of Rock and Roll
on the big Island. Enter Now!
http://r.lycos.com/r/sagel_mail/http://www.elvis.lycos.com/sweepstakes
More information about the Opensource
mailing list