I am running a service A which has a class X. I am going to deploy another service B on same machine which is using this class X. How can I make sure that the same instance of service A is reused instead of another.
PS:Service written in JAVA.
Adding: Both these services are Axis2 services. Service B is hot-deployed. Service B used class Y which is extension of class X.
Could we try to distinguish classes, objects and services.
You have something like this?
and you want to add
So clearly we don’t want to cut and paste between the two implementations. How do we reuse?
Alternative 1:
Directly call A from B. You are asking how to do that. It could be done. You would just code a JAX-WS client call in your implmentation. However I stringly recommend against this. A service call is likely to be more expensive than a simple Java call.
Only do this if y6ou don’t have the option of deploying the two service classes together.
Alternative 2:
Refactor the implementation. Just move the code into a worker class.
@javax.jws.WebService
public class ServiceAAA{
@javax.jws.WebService
public class ServiceBBB{