在Python中使用Suds for SOAP,suds.client.Client对象线程安全吗? [英] Using Suds for SOAP in python, are suds.client.Client objects thread safe?
问题描述
我正在使用Suds从python访问SOAP Web服务.如果我有多个执行的threading.Thread线程,它们中的每个线程可以安全地同时访问同一suds.client.Client实例,还是必须为每个线程创建单独的Client对象?
I'm using Suds to access a SOAP web service from python. If I have multiple threading.Thread threads of execution, can each of them safely access the same suds.client.Client instance concurrently, or must I create separate Client objects for each thread?
推荐答案
据我所知,它们不是线程安全的.只要使用队列或线程池,就可以安全地使用相同的客户端对象.这样,当客户端完成一个线程时,下一个线程就可以使用它.
As far as I know they are NOT thread safe. You could safely use the same client object so long as you are using a queue or thread pool. That way when one thread is done with the client, the next one can use it.
但是,对于基于网络的事件,您应该问自己哪个更好.线程还是异步网络编程?最近针对SUDS提出了一个修补程序,以支持对基于事件的异步套接字的支持. Twisted,greenlets等软件包.
For network-based events however, you should probably ask yourself which is better. Threading or asynchronous network programming? There was recently a patch proposed to SUDS to enable support for asynch sockets for use with event-based packages such as Twisted, greenlets, etc.
这篇关于在Python中使用Suds for SOAP,suds.client.Client对象线程安全吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!