首页 > 编程语言 > 详细

为WebService指定线程池

时间:2017-01-05 22:42:27      阅读:412      评论:0      收藏:0      [点我收藏+]

通过阅读WebService发布过程的源代码,可以配置自定义的线程池

 

package org.zln.ws.server;

import com.sun.xml.internal.ws.api.BindingID;
import com.sun.xml.internal.ws.transport.http.server.EndpointImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.xml.ws.WebServiceFeature;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/**
* Created by sherry on 16/12/15.
*/
public class Main {

/**
* 日志
*/
private static Logger logger = LoggerFactory.getLogger(Main.class);

public static void main(String[] args) {
UserService userService = new UserService();
String address = "http://localhost:8080/Service/UserService";
EndpointImpl endpoint = new EndpointImpl(BindingID.parse(userService.getClass()), userService, new WebServiceFeature[0]);
Executor executor = Executors.newFixedThreadPool(2);
endpoint.setExecutor(executor);
endpoint.publish(address);

logger.debug("Service服务发布成功");
}

}

为WebService指定线程池

原文:http://www.cnblogs.com/sherrykid/p/6254177.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!