New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create Channel from class AioServerSocketChannel #725
Comments
I think that the problem is in AioServerSocketChannel: class has no nullary constructor which is needed for newInstance() function. |
Normally you would need to use this for ServerChannel implementations that not contain a no-args constructor: AioEventLoopGroup parentGroup = new AioEventLoopGroup();
AioEventLoopGroup childGroup = new AioEventLoopGroup();
bootstrap = new ServerBootstrap();
bootstrap.group(parentGroup, childGroup)
.channelFactory(new ChannelFactory() {
@Override
public Channel newChannel() {
return new AioServerSocketChannel(parentGroup, childGroup);
}
})
.localAddress(isa)
.option(ChannelOption.SO_BACKLOG, 100)
.childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, 100)
.childOption(ChannelOption.SO_REUSEADDR, true)
.childOption(ChannelOption.TCP_NODELAY, true)
.childHandler(channelInitializer);
bootstrap.bind(); But I think we should make that easier.. Let me take care of this |
Thanks a lot for help! This is a little bit confusing but works perfect. |
np... in the next release it should also work without the need of create the factory by yourself. |
* 'master' of git://github.com/netty/netty: (45 commits) Allow easier use of AIO transport via bootstrap. Related to [netty#725] Fix a compilation error Fix a failing test Fix a compilation error (sorry!) More robust localhost resolution Use 'x' over "x" wherever possible / String.equals("") -> isEmpty() Add 'static' modifier to the methods that don't need to be member methods Replace keySet() + unnecessary map lookup with entrySet() Make classes static wherever possible Fix unchecked warnings Use foreach loop wherever possible / Prefer String.contains() to indexOf() >= 0 / Prefer StringUtil.split() to String.split() DefaultHttpDataFactory.MINSIZE must be final Remove methods overridden but identical with the super implementation / Make constructors of abstract classes protected rather than non-sense public Remove unnecessary throws clauses for unchecked exceptions Remove unused imports Remove various unnecessary qualifiers Remove redundant field initialization Suppress false positives related with utility class inspections. Remove redundant throws clauses / Suppress inspections for some false positives [netty#719] Handle http requests without an absolute path the right way when encoding them, which is adding / to it ...
just tested with the latest changes using the starting template but running into 'factory already set'. Ended up the use the mentioned work around |
@dantran intresting.. could you add the stacktrace into here ? |
@dantran, it should be fixed now. |
See b3be152 for the diff. |
Well, I am trying to launch a server using AioServerSocketChannel.
The code is like this:
The problem is when I launch application such exception occures:
When I rewrite code to use NIO implementation it works fine.
Where can be the problem? Do I initialize AIO server correctly?
P.S. Sorry for my ban English.
The text was updated successfully, but these errors were encountered: