Package com.sshtools.synergy.nio
Class SelectorThreadPool
java.lang.Object
com.sshtools.synergy.nio.SelectorThreadPool
Maintains a pool of
SelectoThreads increasing the pool when required
and always maintaining the minimum number of permanent threads required.-
Constructor Summary
ConstructorsConstructorDescriptionSelectorThreadPool(SelectorThreadImpl impl, int permanentThreads, int maximumChannels, int idleServicePeriod, int inactivePeriodsPerIdleEvent, SelectorProvider selectorProvider) Construct a thread pool. -
Method Summary
Modifier and TypeMethodDescriptionvoidintvoidregister(ServerSocketChannel socketChannel, int ops, ClientAcceptor acceptor, boolean wakeup) Select the next available thread with the minimum load.voidshutdown()Shutdown all threads in the pool.
-
Constructor Details
-
SelectorThreadPool
public SelectorThreadPool(SelectorThreadImpl impl, int permanentThreads, int maximumChannels, int idleServicePeriod, int inactivePeriodsPerIdleEvent, SelectorProvider selectorProvider) throws IOException Construct a thread pool. if(Log.isDebugEnabled()) Log.debug(- Parameters:
impl- SelectorThreadImplpermanentThreads- intmaximumChannels- intidleServicePeriod- intinactivePeriodsPerIdleEvent- intselectorProvider- SelectorProvider- Throws:
IOException
-
-
Method Details
-
closeAllChannels
public void closeAllChannels() -
shutdown
public void shutdown()Shutdown all threads in the pool. -
getCurrentLoad
public int getCurrentLoad() -
selectNextThread
Select the next available thread with the minimum load.- Returns:
- SelectorThread
- Throws:
IOException
-
register
public void register(ServerSocketChannel socketChannel, int ops, ClientAcceptor acceptor, boolean wakeup) throws ClosedChannelException - Throws:
ClosedChannelException
-