work in progress #1281

This commit is contained in:
Greg Wilkins 2017-05-11 15:40:02 +02:00
parent 861432a334
commit 3c2ff283a2
2 changed files with 13 additions and 6 deletions

View File

@ -387,11 +387,15 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
SelectableChannel server = key.channel();
SelectableChannel channel = null;
try
{
while(true)
{
channel = _selectorManager.doAccept(server);
if (channel!=null)
if (channel==null)
break;
_selectorManager.accepted(channel);
}
}
catch (Throwable x)
{
closeNoExceptions(channel);
@ -534,7 +538,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
{
try
{
SelectionKey key = _channel.register(_selector, SelectionKey.OP_ACCEPT, null);
SelectionKey key = _channel.register(_selector, SelectionKey.OP_ACCEPT, "Acceptor");
if (LOG.isDebugEnabled())
LOG.debug("{} acceptor={}", this, key);
}

View File

@ -240,10 +240,13 @@ public class UnixSocketConnector extends AbstractConnector
{
if (_acceptChannel == null)
{
File file = new File(_unixSocket);
file.deleteOnExit();
SocketAddress bindAddress = new UnixSocketAddress(file);
UnixServerSocketChannel serverChannel = UnixServerSocketChannel.open();
SocketAddress bindAddress = new UnixSocketAddress(new File(_unixSocket));
serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
serverChannel.configureBlocking(getAcceptors()>0);
serverChannel.socket().bind(bindAddress, getAcceptQueueSize());
addBean(serverChannel);
LOG.debug("opened {}",serverChannel);
@ -287,7 +290,7 @@ public class UnixSocketConnector extends AbstractConnector
@Override
public void accept(int acceptorID) throws IOException
{
LOG.warn("Blocking UnixSocket accept used. Cannot be interrupted!");
LOG.debug("Blocking UnixSocket accept used. Might not be able to be interrupted!");
UnixServerSocketChannel serverChannel = _acceptChannel;
if (serverChannel != null && serverChannel.isOpen())
{