1 回答
TA贡献1825条经验 获得超4个赞
给你:
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
// you need to provide a default configuration
JettyHTTPServerEngineFactory serverEngineFactory = sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
JettyHTTPServerEngine eng = new JettyHTTPServerEngine();
eng.setPort(0); // with the port zero
ThreadingParameters defaultThreadingParams = new ThreadingParameters();
defaultThreadingParams.setMinThreads(5);
defaultThreadingParams.setMaxThreads(10);
defaultThreadingParams.setThreadNamePrefix("myjetty");
eng.setThreadingParameters(defaultThreadingParams);
serverEngineFactory.setEnginesList(Arrays.asList(eng));
sf.setResourceProvider(HelloWorldResource.class, new SingletonResourceProvider(new HelloWorldResource()));
sf.setAddress("http://localhost:9000/");
sf.create();
根据我的测试,至少应该指定 4 个线程。
使用 CXF 3.3.3 测试
添加回答
举报