Netty on Android - IllegalSelectorException

Monk funkmonk at gmx.net
Sun Jan 18 08:42:03 EST 2009


Hi,
I try to port a Netty client to Android (using Netty 3.1.0 ALPHA3) and ran
into some trouble. Especially in this area of the code:

private void initClientConnection() {
        String host = "10.0.2.2";
        int port = 8080;

        this.factory =
            new NioClientSocketChannelFactory(
            Executors.newCachedThreadPool(),
            Executors.newCachedThreadPool());

        this.bootstrap = new ClientBootstrap(factory);

        this.handler = new ClientLogicHandler(this.main);

        this.clPipelineFactory = new PipelineFactory(this.handler);
        bootstrap.setPipelineFactory(this.clPipelineFactory);

        bootstrap.setOption("child.tcpNoDelay", true);
        bootstrap.setOption("child.keepAlive", true);
        bootstrap.setOption("remoteAddress", new InetSocketAddress(host,
port));
    }

When simply running or debugging my program in the Android emulator (using
Eclipse), the following Exception appears:

threadid=17: thread exiting with uncaught exception (group=0x40010e28)
Uncaught handler: thread Thread-10 exiting due to uncaught exception
  java.nio.channels.IllegalSelectorException
 
java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:133)
  java.nio.channels.SelectableChannel.register(SelectableChannel.java:117)
 
org.jboss.netty.channel.socket.nio.NioProviderMetadata$ConstraintLevelAutodetector
    .autodetectWithoutTimeout(NioProviderMetadata.java:300)
 
org.jboss.netty.channel.socket.nio.NioProviderMetadata$ConstraintLevelAutodetector$1
    .run(NioProviderMetadata.java:242)
 
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:72)
  java.lang.Thread.run(Thread.java:935)

I ran through it with the debugger and the exception seems to appear when
the first NioWorker gets created somewhere in the
NioClientSocketChannelFactory constructor which instantiates
NioClientSocketPipelineSink.

Any suggestions what might be the problem? I would really appreciate your
help!

-- 
View this message in context: http://n2.nabble.com/Netty-on-Android---IllegalSelectorException-tp2177020p2177020.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list