Making something thread safe can be complicated, depending on what
you're doing. Throwing a few "synchronized" keywords around the place
without understanding what it really means and what the consequences are
may cause you trouble. Threading is somewhat off topic for this forum -
you'd be better off looking for a java forum, or else you could try the
O'Reilly Java Threads book:
http://oreilly.com/catalog/9781565922167

The book's quite old now, but Java threading hasn't changed since it was
written.

Paul

Ho Jimmy wrote:
> 2010/3/25 Lothar Kimmeringer <[email protected]
> <mailto:[email protected]>>
>
>     Ho Jimmy schrieb:
>
>     > I am new to GWT. So, this is a newbie question but I have google
>     it a
>     > while but I am not able to find a simple example.
>     > How can I create the servlet thread safe? For traditional
>     servlet, we
>     > use Threadlocal. So how can we define the similiar for GWT RPC
>     servlet?
>     > Pls also describe a bit about the thread pool and I can have some
>     > direction of my learning.
>
>     The RPC-servlet is a regular servlet, so the way you solved
>     it with other servlets should work there as well. Personally
>     I ensure thread safety by not using global variables. Parts
>     that use concurrent resources I put into a synchronized block.
>
>
>     Regards, Lothar
>
>     --
>     You received this message because you are subscribed to the Google
>     Groups "Google Web Toolkit" group.
>     To post to this group, send email to
>     [email protected]
>     <mailto:[email protected]>.
>     To unsubscribe from this group, send email to
>     [email protected]
>     <mailto:google-web-toolkit%[email protected]>.
>     For more options, visit this group at
>     http://groups.google.com/group/google-web-toolkit?hl=en.
>
>  
> Thank you for the replys. Can you please post a very simple example on
> how the variables are accessed one thread at a time and how they are
> shared by different threads? This example can make this step solid for
> me because I dont know either how to test the servlet is thread safe
> or not.
>  
> Thanks a lot
> -- 
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to