How to share ClassLoader bewteen different Plugins

Thank you for the response. This idea worked wonderfully.
To share the things I did,

  1. I created a shared package that will be consumed by both plugin.
  2. Create implementation of ActionRequest and ActionResponse that is right for you. Make sure to override readFrom and writeTo. This is key to enable recreating the Request and Response when communicating between plugin.
  3. In the shared plugin, created a class that implements from org.elasticsearch.action.Action which accepts specific request type and return generic ActionResponse.
  4. In Plugin that is receiving the call, create class that implements HandledTransportAction with generic ActionRequest and MyResponse which is the implementation of ActionResponse
  5. In MyHandledTransportAction will use readFrom in ActionRequest to create correct RequestType. Once MyRequest is recreated then all the information for the request is there and now do what is needed for the Request and return MyResponse.
  6. From MyPlugin send request with specific request format but it will get back ActionResponse. Once the ActionResponse is returned from the client, use the readFrom method to get the specific type of the response back.

Thank you for the help and feel free to close this thread.