Don't use class scoped variables.  Only use local variables on the stack,
and everything will be fine.  

Generally speaking, you're returning a new Collection for each request
anyway.  In that case, each user will still have their own copy of the
Collection.

-Josh

-----Original Message-----
From: Michael Ruppin [mailto:[EMAIL PROTECTED]
Sent: Monday, June 02, 2003 4:17 PM
To: Struts Users Mailing List
Subject: Re: Collection Implementation


Gee, isn't thread safty an issue with Struts?  I
thought I should use synchronized Objects in my
Actions.

--- David Graham <[EMAIL PROTECTED]> wrote:
> Vector was a poorly designed class that has been
> replaced by ArrayList.  New 
> code should not use Vector.  If you need a
> synchronized list do this 
> instead:
> 
> List myList = Collections.synchronizedList(new
> ArrayList());
> 
> David
> 
> >Without checking the archives for specific
> references,
> >I'm still sure I've read on multiple occasions,
> "Don't
> >use Vectors, use ArrayLists".  I was under the
> >impression that this was because Vectors are not
> >synchronized.  After refactoring, today, I read
> here
> >that ArrayLists are not synchronized:
> >
>
>http://java.sun.com/j2se/1.4.1/docs/api/java/util/ArrayList.html
> >
> >Time to refactor again?  I need to be using one of
> the
> >static Collections.synchronized* methods, right?
> >Beyond using Objects that are synchronized, what
> >difference does it make which implementation of
> >Collection I choose?
> >
> >m
> >
> >
> >__________________________________
> >Do you Yahoo!?
> >Yahoo! Calendar - Free online calendar with sync to
> Outlook(TM).
> >http://calendar.yahoo.com
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> >For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> 
>
_________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online  
>
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

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

Reply via email to