struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <hus...@apache.org>
Subject Re: Quick question about iterators & beans on a page
Date Sat, 16 Feb 2002 18:34:55 GMT
The container gives each request its own thread. 

If the list is created with new in the action, and then placed into the
request, it is thread-safe. Just the same as if you had created it on
the JSP. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Java Web Development with Struts.
-- Tel +1 585 737-3463.
-- Web http://www.husted.com/struts/



Adam Hardy wrote:
> 
> On Sat, 16 February 2002, Mark Woon wrote:
> > > (2) is it thread-safe? Guess it must be, but why? Does it all stay in one thread
of the main struts controller servlet, and out of reach of any other threads?
> >
> > Depends on what you mean.  If it's a read-only collection, then sure, it's "thread
safe".  But if you expect that list to change, then no, it's not thread-safe, because multiple
> > requests from the same user would be able to access the collection.
> >
> > -Mark
> 
> Argh! The list is user dependent - it's got to be thread-safe.
> 
> So if the Action puts the array for the iterator in the request, how can I make sure
that no other user gets it?
> 
> I know what you're going to say - put it in the session, right? But then at the end of
the day a user who uses the site intensively all day might end up with a rowset or even two
in their session for every page in the site.
> 
> So what do I do?
> 
> Thanks
> Adam
> 
> Find the best deals on the web at AltaVista Shopping!
> http://www.shopping.altavista.com
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message