return false;
}
protected CookieManager getCookieManager(String ipAddr)
{
CookieManager cm = null;
// First have to release the cookie we were using so other
// threads stuck in wait can move on
synchronized(managersInUse)
{
if(lastUsed != null)
{
managersInUse.remove(lastUsed);
managersInUse.notify();
}
}
// let notified threads move on and get lock on managersInUse
if(lastUsed != null)
{
Thread.yield();
}
// here is the core routine to find appropriate cookie manager and
// check it's not being used. If used, wait until whoever's using it gives
// it up
synchronized(managersInUse)
{
cm = (CookieManager)cookieManagers.get(ipAddr);
if(cm == null)
{
cm = new CookieManager();
cookieManagers.put(ipAddr,cm);
}
while(managersInUse.contains(cm))
{
try {