I have an application that uses a shared resource that is for all intensive
purposes similar to a database connection.  The only difference is that
unlike a standard database connection I can't just create more connections
in my connection pool like I can with my db connection pool (the reason is
irrelevant but for those that question, setting up these connection objects
entails a fee as well as about a week of time to get the service connected
via a service call to the office).

My question is whether or not calling Thread.sleep() within a servlet's
doGet/doPost/service method until the connection is available is a
safe/standard practice.  This is a sample of what I'm thinking of doing:

while ((myConn = getConnection()) == null)
{
    Thread.sleep(250);
}

Is this thread safe?
Any ideas of whether it will cause serious performance degradation?

Thanks for advice.

Mike

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to