简体   繁体   English

并发Java SOAP Web服务

[英]Concurrent java SOAP web service

I'm developing an android application that communicates with a java SOAP web service. 我正在开发一个与Java SOAP Web服务通信的android应用程序。 It works fine but I've done nothing to make the web service concurrent. 它工作正常,但是我并没有做任何事情使Web服务并发。 I'm wondering if the web service would create a thread for every incoming request or should I have to do it. 我想知道Web服务是否会为每个传入请求创建一个线程,还是我必须这样做。

This is the Web Method I have: 这是我拥有的Web方法:

public class WebServer {
    public String doSomething(String arg1, int arg2) {
        //doSomething
        return string;
    }
}

I'm making a request from Android with the KSOAP2 library, this will be the client. 我正在使用KSOAP2库从Android请求,这将是客户端。 I know how to create a thread inside the "doSomething" method, but I don't know how to make that thread response to the correct client. 我知道如何在“ doSomething”方法内创建线程,但是我不知道如何使线程响应正确的客户端。

So if the java web server running over Tomcat creates a thread for every request I have no problem, but if not, how would I achieve that? 因此,如果运行在Tomcat上的Java Web服务器为每个请求都创建了一个线程,我没有问题,但是如果没有,我将如何实现呢?

Yes, Tomcat (your app server) will manage the threads. 是的,Tomcat(您的应用服务器)将管理线程。 You do not need to handle this yourself inside your Java code. 您无需在Java代码中自己处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM