Do I need to close the JAX-WS port?

Some tutorials (like here , here and here ) suggest closing the JAX-WS port by pointing it at com.sun.xml.ws.Closeablefor example

MyPortType port = MyService.getMyPort();
... do some operations on WS proxy ...
((com.sun.xml.ws.Closeable) port).close();

This approach will not work for proxies returned JaxWsPortProxyFactoryBeansince it only requests the target WS and interface javax.xml.ws.BindingProvider.

So my question is: do I need to close the port (given that it is reused in the application)? If it is better to close the port (and possibly reduce it to zero), then how to properly organize the ports life cycle (when implemented, the created w760 proxies will always be single)?

+3
source share
2 answers

, , . JAX-WS , .

JaxWsPortProxyFactoryBean, . , Spring FactoryBeans.

+2

JavaDoc com.sun.xml.ws.Closeable :

This signals the implementation of certain specs (like WS-ReliableMessaging and
WS-SecureConversation) to terminate sessions that they create during the life
time of a proxy object. This is not a mandatory operation, so the application
does not have to call this method.

WSIT:

Calling close() method provides a way for WSIT components, such as Reliable
Messaging and Secure Conversations to do clean-up activities related to client
instance. Sometimes calling close() can be avoided without harmful effects.
+4

Source: https://habr.com/ru/post/1766839/


All Articles