Java Webservice multithreaded
To have a JAX-WS Webservice in Java 6 or higher with multiple threads, it is necessary to assign an corresponding Executor to the endpoint (the sample uses 5 threads).
import java.util.concurrent.Executors; import javax.xml.ws.Endpoint; import com.sun.net.httpserver.HttpContext; import com.sun.net.httpserver.HttpServer; httpServer = HttpServer.create(new InetSocketAddress(interfaceName, port), 0); HttpContext httpContext = httpServer.createContext("/path"); Endpoint endpoint = Endpoint.create(serviceImpl); endpoint.setExecutor(Executors.newFixedThreadPool(5)); endpoint.publish(httpContext);