Issue #354 (Spin loop in case of exception thrown during accept()).

Improved the solution by sleeping only if we are still accepting.
This avoids the sleep when the connector is stopping, speeding up tests.
This commit is contained in:
Simone Bordet 2016-05-19 11:48:24 +02:00
parent 79e5c31029
commit ff1bfa599f
1 changed files with 12 additions and 12 deletions

View File

@ -536,22 +536,22 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co
LOG.warn(current);
else
LOG.debug(current);
try
{
// Arbitrary sleep to avoid spin looping.
// Subclasses may decide for a different
// sleep policy or closing the connector.
Thread.sleep(1000);
return true;
}
catch (Throwable x)
{
return false;
}
}
else
{
LOG.ignore(current);
}
try
{
// Arbitrary sleep to avoid spin looping.
// Subclasses may decide for a different
// sleep policy or closing the connector.
Thread.sleep(1000);
return true;
}
catch (Throwable x)
{
return false;
}
}