org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor Java Examples

The following examples show how to use org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AirPlayServer.java    From Android-Airplay-Server with MIT License 5 votes vote down vote up
private AirPlayServer(){
	//create executor service
	executorService = Executors.newCachedThreadPool();
	
	//create channel execution handler
	channelExecutionHandler = new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(4, 0, 0));

	//channel group
	channelGroup = new DefaultChannelGroup();
	
	//list of mDNS services
	jmDNSInstances = new java.util.LinkedList<JmDNS>();
}
 
Example #2
Source File: WebSocketServer.java    From usergrid with Apache License 2.0 5 votes vote down vote up
public void startServer() {
    if ( ( properties != null ) && ( Boolean
            .parseBoolean( properties.getProperty( "usergrid.websocket.disable", "false" ) ) ) ) {
        logger.info( "Usergrid WebSocket Server Disabled" );
        return;
    }

    logger.info( "Starting Usergrid WebSocket Server" );

    if ( realm != null ) {
        securityManager = new DefaultSecurityManager( realm );
    }

    ServerBootstrap bootstrap = new ServerBootstrap(
            new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool() ) );

    // Set up the pipeline factory.
    ExecutionHandler executionHandler =
            new ExecutionHandler( new OrderedMemoryAwareThreadPoolExecutor( 16, 1048576, 1048576 ) );

    // Set up the event pipeline factory.
    bootstrap.setPipelineFactory(
            new WebSocketServerPipelineFactory( emf, smf, management, securityManager, executionHandler, ssl ) );

    // Bind and start to accept incoming connections.
    channel = bootstrap.bind( new InetSocketAddress( 8088 ) );

    logger.info( "Usergrid WebSocket Server started..." );
}
 
Example #3
Source File: MongoServer.java    From usergrid with Apache License 2.0 5 votes vote down vote up
public void startServer() {

        if ( ( properties != null ) && ( Boolean
                .parseBoolean( properties.getProperty( "usergrid.mongo.disable", "false" ) ) ) ) {
            logger.info( "Usergrid Mongo Emulation Server Disabled" );
            return;
        }

        logger.info( "Starting Usergrid Mongo Emulation Server" );

        if ( realm != null ) {
            securityManager = new DefaultSecurityManager( realm );
        }

        // Configure the server.
        ServerBootstrap bootstrap = new ServerBootstrap(
                new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), Executors.newCachedThreadPool() ) );

        bootstrap.setOption( "child.bufferFactory", HeapChannelBufferFactory.getInstance( ByteOrder.LITTLE_ENDIAN ) );

        // Set up the pipeline factory.
        ExecutionHandler executionHandler =
                new ExecutionHandler( new OrderedMemoryAwareThreadPoolExecutor( 16, 1048576, 1048576 ) );
        // TODO if config'ed for SSL, start the SslMSPF instead, change port as well?
        bootstrap.setPipelineFactory(
                new MongoServerPipelineFactory( emf, smf, management, securityManager, executionHandler ) );

        // Bind and start to accept incoming connections.
        channel = bootstrap.bind( new InetSocketAddress( 27017 ) );

        logger.info( "Usergrid Mongo API Emulation Server accepting connections..." );
    }
 
Example #4
Source File: LoginToClientPipeLineFactory.java    From aion-germany with GNU General Public License v3.0 4 votes vote down vote up
public LoginToClientPipeLineFactory(ClientPacketHandler clientPacketHandler) {
    this.clientPacketHandler = clientPacketHandler;
    this.executionHandler = new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(THREADS_MAX, MEMORY_PER_CHANNEL, TOTAL_MEMORY, TIMEOUT, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory()));
}