----------------------------------------------------
Please read the FAQ at <http://java.apache.org/faq/>
It does have a search feature!

We cannot guess what you are trying to do:
#1. Include version numbers for all software.
#2. Include relevant configuration settings.
#3. Include full descriptions of the problem.

Got Linux? Seeing lots of java processes?
<http://java.apache.org/faq/?file=274>
----------------------------------------------------

Fernando,

        That was exactly the answer I was looking for!
Thanks so much.

        -Tom

Fernando Salazar wrote:
> 
> There is only 1 User object instance created.  You have a reference to that
> instance in your local variable 'u'; you
> also stash a reference to the User object inside the session
> object.  Although 'u' goes out of scope when the method ends,
> the session object still exists and holds a reference to your object, and
> so it will not be GC'ed.
> 
> Now, is it thread-safe?  Well, the session object maps to a specific
> browser client, identified by either a cookie or a value from an
> URL.  Under normal conditions, 2 browsers will never map to the same
> session object, so there should never be 2 simultaneous requests against 1
> session, and by extension never 2 simultaneous requests accessing the same
> User object instance.  If you were paranoid, you could wrap the Validate
> call with a synchronize on u, for example:
> 
>                 synchronize( u ) {
>                         Validate u
>                 }
> 
> but like I said, you would never need to do this unless something weird was
> happening -- like someone forging URLs and trolling for session IDs.
> 
> Hope this helps ...
> 
> - Fernando
> 
           [EMAIL PROTECTED]

-- 
+-------------------------------------------------------------------+
+  Thomas M. Sasala, Electrical Engineer       [EMAIL PROTECTED]       +
+  MRJ Technology Solutions                    http://www.mrj.com   +
+  10461 White Granite Drive, Suite 102        (W)(703)277-1714     +
+  Oakton, VA   22124                          (F)(703)277-1702     +
+-------------------------------------------------------------------+


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to