With a method like that, we have to ensure that it is called by
only one thread.  If the code snippet you have below is called
by every thread accessing the MRUStore, then it should be synchronized.
However, that will slow down the Cache to the point where it would
be cheaper to not have it.

It would be better to ensure that the method that contains that snippet
only be called by a controlling thread--where you can be assured that
there is only one thread, and that the snippet no longer needs
explicit synchronization.

Remember, uncontended synchronization is cheap--but contended
synchronization
is expensive.  Control code should be done asynchronously from the rest
of the system, and only by one thread.

> -----Original Message-----
> From: Carsten Ziegeler [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, March 26, 2002 8:53 AM
> To: Cocoon-Dev
> Subject: [Bug?] Cocoon MRUStore not synchronized
> 
> 
> Hi Team,
> 
> after investigating a little bit in some lockups I found out 
> that the MRUStore is not synchronized. Is this by intention?
> 
> It seems that under high load and with a little bit of luck 
> all threads hang in this loop in the hold() method:
> 
> while (this.mrulist.size() >= this.maxobjects) {
>             /** ...ok, heapsize is reached, remove the last 
> element... */
>             this.free();
> }
> 
> This is only an assumption. Anyone if this might be possible 
> with let's say 100 concurrent threads?
> 
> Carsten
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to