Bo Xu wrote:
>
> Hi Kevin :-)
>
> Thanks for your email :-) I agree with your email, but I didn't
> explain it clearly in my last email, because my English is
> not good :-) :-)
>
> And sorry for bothering you :-) I want to ask a question :-)
> Did you know the "mechanism" of the servlet engine which will
> use "instance pool"? -- if threadA is made by insatanceA, and
> threadB is made by insatanceB, then:
>
> * Do threadA and threadB "share" "static class variable" ?
> I guess Yes :-) , because insatanceA and insatanceB are
> "from" the same class , but I want to make sure :-)
> * Do threadA and threadB "share" "not_static class variable" ?
> I guess Not from the "theory" :-), but I also want to make sure :-)
If instance A and instance B are instances of the same class, in the
same virtual machine, loaded by the same class loader, then there is
only a single incarnation of the static variable. This single
incarnation is shared by the Instance A and Instance B.
Instance variables which are not static are separate. Instance A has its
own incarnation of the instance variables, and Instance B has its own
separate incarnation of the instance variables. So Thread A and Thread B
access different variables.
Kevin Mukhar
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html