When a client send a action or rpc request to confd server, whether the lock is needed to ensure only one request is sent and be executed in confd server since action or rpc may be write operation ?
E.g. I am using JNC in my client application. When I send action request to server, do I need something like
to ensure there is only one thread send action() request to a specific server anytime ?
It definitely is not necessary. Lock is just a means “to make a change without fear of interaction with other […] clients” (misquoting the NETCONF RFC), you do not have to use it if you do not expect concurrent client access or you just don’t care.
Also, keep in mind that it is not blocking, so using it correctly in your application may require some careful error handling; if you want to protect yourself from concurrency issues in your threads, I suggest you use Java tools, such as synchronized methods or code blocks.