368240: Improved handling of dispatch failure

This commit is contained in:
Greg Wilkins 2012-01-11 01:12:36 +11:00
parent a7783ae568
commit 8fcc22df32
3 changed files with 7 additions and 2 deletions

View File

@ -260,7 +260,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
for (int i=0;i<getSelectSets();i++)
{
final int id=i;
dispatch(new Runnable()
boolean selecting=dispatch(new Runnable()
{
public void run()
{
@ -303,6 +303,9 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
}
});
if (!selecting)
throw new IllegalStateException("!Selecting");
}
}

View File

@ -321,7 +321,8 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Ht
_acceptorThread = new Thread[getAcceptors()];
for (int i = 0; i < _acceptorThread.length; i++)
_threadPool.dispatch(new Acceptor(i));
if (!_threadPool.dispatch(new Acceptor(i)))
throw new IllegalStateException("!accepting");
if (_threadPool.isLowOnThreads())
LOG.warn("insufficient threads configured for {}",this);
}

View File

@ -363,6 +363,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
return true;
}
}
LOG.debug("Dispatched {} to stopped {}",job,this);
return false;
}