当前位置: 首页>>代码示例>>Java>>正文


Java OrderedMemoryAwareThreadPoolExecutor类代码示例

本文整理汇总了Java中org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor的典型用法代码示例。如果您正苦于以下问题:Java OrderedMemoryAwareThreadPoolExecutor类的具体用法?Java OrderedMemoryAwareThreadPoolExecutor怎么用?Java OrderedMemoryAwareThreadPoolExecutor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OrderedMemoryAwareThreadPoolExecutor类属于org.jboss.netty.handler.execution包,在下文中一共展示了OrderedMemoryAwareThreadPoolExecutor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: OpenVirteXController

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
public OpenVirteXController(CmdLineSettings settings) {
    this.ofHost = settings.getOFHost();
    this.ofPort = settings.getOFPort();
    this.dbHost = settings.getDBHost();
    this.dbPort = settings.getDBPort();
    this.dbClear = settings.getDBClear();
    this.maxVirtual = settings.getNumberOfVirtualNets();
    this.statsRefresh = settings.getStatsRefresh();
    this.nClientThreads = settings.getClientThreads();
    this.nServerThreads = settings.getServerThreads();
    this.useBDDP = settings.getUseBDDP();
    // by default, use Mac addresses to store vLinks informations
    this.ovxLinkField = OVXLinkField.MAC_ADDRESS;
    this.clientThreads = new OrderedMemoryAwareThreadPoolExecutor(
            nClientThreads, 1048576, 1048576, 5, TimeUnit.SECONDS);
    this.serverThreads = new OrderedMemoryAwareThreadPoolExecutor(
            nServerThreads, 1048576, 1048576, 5, TimeUnit.SECONDS);
    this.pfact = new SwitchChannelPipeline(this, this.serverThreads);
    OpenVirteXController.instance = this;
    OpenVirteXController.tenantIdCounter = new BitSetIndex(
            IndexType.TENANT_ID);
}
 
开发者ID:CoVisor,项目名称:CoVisor,代码行数:23,代码来源:OpenVirteXController.java

示例2: getPipeline

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
@Override
public ChannelPipeline getPipeline() throws Exception {
	ChannelPipeline ret = Channels.pipeline();
	ret.addLast("executor", new ExecutionHandler(
			new OrderedMemoryAwareThreadPoolExecutor(8, 1048576, 1048576)));
	ret.addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
	ret.addLast("protobufDecoder",
			new ProtobufDecoder(GameMsg.getDefaultInstance()));
	ret.addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
	ret.addLast("protobufEncoder", new ProtobufEncoder());
	// ret.addLast("heartbeat", new IdleStateAwareChannelHandler() {
	// @Override
	// public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e)
	// throws Exception {
	// logger.warn("close the channel hearbeat {} type={}",
	// e.getChannel(), e.getState());
	// e.getChannel().close();
	// }
	// });
	ret.addLast("handler", pdlServerHandlerFactory.get());
	return ret;
}
 
开发者ID:nichoding,项目名称:daisy-network,代码行数:23,代码来源:PdlChannelPipelineFactory.java

示例3: postConstruct

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
@PostConstruct
private void postConstruct() {
	
	nettyThreadFactory = new NettyThreadFactory();
	
	executionHandler = new ExecutionHandler(
            new OrderedMemoryAwareThreadPoolExecutor(
            		configurationService.getIntValue("netty.maxChannels"), 
            		configurationService.getIntValue("netty.maxChannelMemory"), 
            		configurationService.getIntValue("netty.maxTotalMemory"),
            		60 * 5,
            		TimeUnit.SECONDS,
            		this,
            		nettyThreadFactory));
	
	i18nService.registerBundle(RESOURCE_BUNDLE);
}
 
开发者ID:ludup,项目名称:hypersocket-framework,代码行数:18,代码来源:NettyServer.java

示例4: AirPlayServer

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
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>();
}
 
开发者ID:SergioChan,项目名称:Android-Airplay-Server,代码行数:14,代码来源:AirPlayServer.java

示例5: createExecutorService

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
protected OrderedMemoryAwareThreadPoolExecutor createExecutorService() {
    // use ordered thread pool, to ensure we process the events in order, and can send back
    // replies in the expected order. eg this is required by TCP.
    // and use a Camel thread factory so we have consistent thread namings
    // we should use a shared thread pool as recommended by Netty
    
    // NOTE: if we don't specify the MaxChannelMemorySize and MaxTotalMemorySize, the thread pool
    // could eat up all the heap memory when the tasks are added very fast
    
    String pattern = getCamelContext().getExecutorServiceManager().getThreadNamePattern();
    ThreadFactory factory = new CamelThreadFactory(pattern, "NettyOrderedWorker", true);
    return new OrderedMemoryAwareThreadPoolExecutor(getMaximumPoolSize(),
            configuration.getMaxChannelMemorySize(), configuration.getMaxTotalMemorySize(),
            30, TimeUnit.SECONDS, factory);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:16,代码来源:NettyComponent.java

示例6: onStart

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
@Override
protected void onStart() throws ServiceException {
	logger.info("{} start on {}", super.getServiceName(), port);
	final ExecutionHandler executionHandler = new ExecutionHandler(
			new OrderedMemoryAwareThreadPoolExecutor(8, 1048576, 1048576));
	final RpcService thisServer = this;
	bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
			Executors.newCachedThreadPool(),
			Executors.newCachedThreadPool()));
	bootstrap.setPipelineFactory(new ChannelPipelineFactory() {

		@Override
		public ChannelPipeline getPipeline() throws Exception {
			ChannelPipeline ret = Channels.pipeline();
			ret.addLast("executor", executionHandler);
			ret.addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
			ret.addLast("protobufDecoder",
					new ProtobufDecoder(RpcMsg.getDefaultInstance()));
			ret.addLast("frameEncoder",
					new ProtobufVarint32LengthFieldPrepender());
			ret.addLast("protobufEncoder", new ProtobufEncoder());
			ret.addLast("handler", new RpcServiceHandler(thisServer));
			return ret;
		}
	});
	bootstrap.setOption("child.tcpNoDelay", rpcConfig.isNoDelay());
	bootstrap.setOption("child.keepAlive", true);
	bootstrap.setOption("reuseAddress", true);
	Channel serverChannel = bootstrap.bind(new InetSocketAddress(port));
	allOpenChannels.add(serverChannel);

}
 
开发者ID:nichoding,项目名称:daisy-network,代码行数:33,代码来源:RpcService.java

示例7: BasicPipelineFactory

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
/**
 * Instantiates a new basic pipeline factory.
 */
public BasicPipelineFactory() {
    this.executorHandler =
            new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(THREADS_MAX,
                    MEMORY_PER_CHANNEL, TOTAL_MEMORY, TIMEOUT, TimeUnit.MILLISECONDS,
                    new ThreadFactoryBuilder().setNameFormat("JMaNGOS-netty-pool-%d").build()));
}
 
开发者ID:JMaNGOS,项目名称:JMaNGOS,代码行数:10,代码来源:BasicPipelineFactory.java

示例8: SingleParticipantSession

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
public SingleParticipantSession(String id, Collection<Integer> payloadTypes, RtpParticipant localParticipant,
                                RtpParticipant remoteParticipant, HashedWheelTimer timer,
                                OrderedMemoryAwareThreadPoolExecutor executor) {
    super(id, payloadTypes, localParticipant, timer, executor);
    if (!remoteParticipant.isReceiver()) {
        throw new IllegalArgumentException("Remote participant must be a receiver (data & control addresses set)");
    }
    ((SingleParticipantDatabase) this.participantDatabase).setParticipant(remoteParticipant);
    this.receiver = remoteParticipant;
    this.receivedPackets = new AtomicBoolean(false);
    this.sendToLastOrigin = SEND_TO_LAST_ORIGIN;
    this.ignoreFromUnknownSsrc = IGNORE_FROM_UNKNOWN_SSRC;
}
 
开发者ID:elasticsoftwarefoundation,项目名称:elasterix,代码行数:14,代码来源:SingleParticipantSession.java

示例9: startServer

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
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..." );
}
 
开发者ID:apache,项目名称:usergrid,代码行数:30,代码来源:WebSocketServer.java

示例10: startServer

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
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..." );
    }
 
开发者ID:apache,项目名称:usergrid,代码行数:33,代码来源:MongoServer.java

示例11: MessagingServer

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
public MessagingServer(MessageReceiptCallback cb, int port) {
    this.messagingServerHandler = new MessagingServerHandler(cb);
    this.port = port;
    
    // Start server with Nb of active threads = 2*NB CPU + 1 as maximum.
    ChannelFactory factory = new NioServerSocketChannelFactory(Executors
            .newCachedThreadPool(), Executors.newCachedThreadPool(),
            Runtime.getRuntime().availableProcessors() * 2 + 1);
 
    bootstrap = new ServerBootstrap(factory);
    // Create the global ChannelGroup
    channelGroup = new DefaultChannelGroup(MessagingServer.class.getName());
    // 200 threads max, Memory limitation: 1MB by channel, 1GB global, 100 ms of timeout
    OrderedMemoryAwareThreadPoolExecutor pipelineExecutor = new OrderedMemoryAwareThreadPoolExecutor(
            200, 1048576, 1073741824, 100, TimeUnit.MILLISECONDS, Executors
                    .defaultThreadFactory());
 
    // We need to use a pipeline factory because we are using stateful handlers
    bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
        @Override
        public ChannelPipeline getPipeline() throws Exception {
            return Channels.pipeline(new ObjectDecoder(getMaxObjectSize()), new ObjectEncoder(), messagingServerHandler);
        }
    });
    bootstrap.setOption("child.tcpNoDelay", true);
    bootstrap.setOption("child.keepAlive", true);
    bootstrap.setOption("child.reuseAddress", true);
    bootstrap.setOption("child.connectTimeoutMillis", 100);
    bootstrap.setOption("readWriteFair", true);
}
 
开发者ID:kaituo,项目名称:sedge,代码行数:31,代码来源:MessagingServer.java

示例12: TextProtocolPipelineFactory

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
public TextProtocolPipelineFactory()
{
	this.eventExecutor = new OrderedMemoryAwareThreadPoolExecutor(5, 1000000, 10000000, 100,
       TimeUnit.MILLISECONDS);
}
 
开发者ID:ZalemSoftware,项目名称:OpenMobster,代码行数:6,代码来源:TextProtocolPipelineFactory.java

示例13: getExecutorService

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
public synchronized OrderedMemoryAwareThreadPoolExecutor getExecutorService() {
    if (executorService == null) {
        executorService = createExecutorService();
    }
    return executorService;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:7,代码来源:NettyComponent.java

示例14: AirPlayServer

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
private AirPlayServer(Context context){
	
	this.context = context ;
	
	//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>();
}
 
开发者ID:lukeqsun,项目名称:AirSpeakerMobile,代码行数:17,代码来源:AirPlayServer.java

示例15: doStart

import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor; //导入依赖的package包/类
public void doStart()
{
    Log.info("RayoComponent initialize " + jid);

    XMPPServer server = XMPPServer.getInstance();

    server.getIQDiscoInfoHandler().addServerFeature(RAYO_CORE);
    rayoProvider = new RayoProvider();
    rayoProvider.setValidator(new Validator());

    server.getIQDiscoInfoHandler().addServerFeature(RAYO_RECORD);
    recordProvider = new RecordProvider();
    recordProvider.setValidator(new Validator());

    server.getIQDiscoInfoHandler().addServerFeature(RAYO_SAY);
    sayProvider = new SayProvider();
    sayProvider.setValidator(new Validator());

    server.getIQDiscoInfoHandler().addServerFeature(RAYO_HANDSET);
    handsetProvider = new HandsetProvider();
    handsetProvider.setValidator(new Validator());

    createIQHandlers();

    try{
        Log.info("Starting jCumulus.....");

        sessions = new Sessions();
        ExecutorService executorservice = Executors.newCachedThreadPool();
        NioDatagramChannelFactory niodatagramchannelfactory = new NioDatagramChannelFactory(executorservice);
        bootstrap = new ConnectionlessBootstrap(niodatagramchannelfactory);
        OrderedMemoryAwareThreadPoolExecutor orderedmemoryawarethreadpoolexecutor = new OrderedMemoryAwareThreadPoolExecutor(10, 0x100000L, 0x40000000L, 100L, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory());

        bootstrap.setPipelineFactory(new ServerPipelineFactory(sessions, orderedmemoryawarethreadpoolexecutor));
        bootstrap.setOption("reuseAddress", Boolean.valueOf(true));
        bootstrap.setOption("sendBufferSize", Integer.valueOf(1215));
        bootstrap.setOption("receiveBufferSize", Integer.valueOf(2048));
        bootstrap.setOption("receiveBufferSizePredictorFactory", new FixedReceiveBufferSizePredictorFactory(2048));

        InetSocketAddress inetsocketaddress = new InetSocketAddress(JiveGlobals.getIntProperty("voicebridge.rtmfp.port", 1935));

        Log.info("Listening on " + inetsocketaddress.getPort() + " port");

        channel = bootstrap.bind(inetsocketaddress);

    } catch (Exception e) {
        Log.error("jCumulus startup failure");
        e.printStackTrace();
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire,代码行数:51,代码来源:RayoComponent.java


注:本文中的org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。