All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nadron.server.netty.FlashPolicyServerChannelInitalizer Maven / Gradle / Ivy

Go to download

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());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy