There is no gaurenteed way that I know of, but here are some guidlines that
have helped me:
    Any method that has the REMOTE chance of bieng called by more than one
thread, "synchronize" it. This allows for only one thread to call a method at a
time.

  Any changes to any variables do through methods.  Even if the variable is
within the same class, use a method.  By synchronizing these, and using these
methods as the exclusive door to the variables, this eliminates any lockups due
to simaltanious accessing.

 Keep track of the threads that are created.  This can be done with
ThreadGroups or with Vectors.  This way all the threads are accounted for, and
you can have the main thread wait until the Vector is empty (as the threads
complete, the destroy themselves and remove themselves from the vector).  This
way, there are "checkpoints" so to speak so that your main thread does not get
ahead of the child threads.  By grouping in ThreadGroups, it is easy to
destroy, stop, continue, ect all the threads.

The biggest thing is debugg paitently.

DanC

Srikanth_Mopidevi wrote:

> Hello All,
>
> Can somebody give me the measures to be taken to ensure that my servlet is
> Thread-Safe.
>
> Cheers
>
> Srikanth Mopidevi
>
> ___________________________________________________________________________
> 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

___________________________________________________________________________
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