Is this JAX-WS client call thread safe?

前端 未结 4 640
情歌与酒
情歌与酒 2020-12-14 06:34

Since initialization of the WS client service and port takes ages I like to initialize them once at startup and reuse the same instance of the port. Initalization would look

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-14 06:59

    In general, no.

    According to the CXF FAQ http://cxf.apache.org/faq.html#FAQ-AreJAX-WSclientproxiesthreadsafe?

    Official JAX-WS answer: No. According to the JAX-WS spec, the client proxies are NOT thread safe. To write portable code, you should treat them as non-thread safe and synchronize access or use a pool of instances or similar.

    CXF answer: CXF proxies are thread safe for MANY use cases.

    For a list of exceptions see the FAQ.

提交回复
热议问题