Liam Dens wrote:
>
> Hi all
>
> Given the scenario below will it be safe?
>
> A servlet needs to create objects on the fly, to do this it will access a
> 'service layer' that will create the required object and then return it.
>
> The method in the ServiceLayerServlet is static because it uses the
> Class.forName() call. This method is accessed in the calling servlet, from
> the doGet() method like so:
>
>    Object obj = (Object) ServiceLayerServlet.getObject(theClassName);
>
> So the question is - The call to ServiceLayerServlet is in the doGet(),
> this should be thread safe - yes?

Yes, everything in the servlet, and everything in classes used by the servlet
must be thread safe. In this particular case, the method
ServiceLayerServlet.getObject(String) must be thread safe. Note that this does
not imply that getObject must be synchronized.

K 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

Reply via email to