<thread-pool name="myThreadPool"> <max-threads>50</max-threads> <keep-alive-time>30000</keep-alive-time> <blocking>false</blocking> </thread-pool> public class MyServer { public static void main(String[] args) throws Exception { ChannelFactory factory = new DefaultChannelFactory(); Channel channel = factory.createChannel(); ThreadPoolExecutor threadPool = new ThreadPoolExecutor( TimeUnit.MILLISECONDS, ); channel.setThreadPool(threadPool); channel.startServer(); channel.accept(); channel.receiveMessage(); channel.stopServer(); } }


上一篇:
下一篇:
切换中文