io.nadron.server.netty.FlashPolicyServerChannelInitalizer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nadron Show documentation
Show all versions of nadron Show documentation
Nadron is a high speed socket based java game server written using Netty and Mike Rettig's Jetlang. It is specifically tuned for network based multiplayer games and supports TCP and UDP network protocols.
The newest version!
package io.nadron.server.netty;
import io.nadron.handlers.netty.FlashPolicyServerDecoder;
import io.nadron.handlers.netty.FlashPolicyServerHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;
/**
* @author Bruce Mitchener
*/
public class FlashPolicyServerChannelInitalizer extends ChannelInitializer
{
// TODO make this configurable from spring.
private static final int MAX_IDLE_SECONDS = 60;
/**
* Spring will return the actual prototype bean from its context here. It
* uses method lookup here.
*
* @return a new instance of the {@link FlashPolicyServerHandler}
*/
protected FlashPolicyServerHandler getFlashPolicyServerHandler()
{
return null;
}
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast("idleStateCheck", new IdleStateHandler(
MAX_IDLE_SECONDS, MAX_IDLE_SECONDS, MAX_IDLE_SECONDS));
pipeline.addLast("decoder", new FlashPolicyServerDecoder());
pipeline.addLast("handler", getFlashPolicyServerHandler());
}
}