changed
changed

Reputation: 2143

java: executing a Object in new JVM instance and getting the results

I have a third party jar that connects to a server and executes command and returns result. But this jar connects to only one server in a single instance of JVM.

So how can i execute a Object of a class in a new JVM instance get the results/ exception back in invoker JVM instance.

Upvotes: 0

Views: 336

Answers (2)

Uriah Carpenter
Uriah Carpenter

Reputation: 6726

Try reflection get to at any non-final state to change the server. Class instances are unique per classloader, so you could load the third-party class in a new custom classloader for each server to connect to.

http://www.google.com/search?q=java%20custom%20classloader

Upvotes: 1

bmargulies
bmargulies

Reputation: 100133

You will have to reverse-engineer the protocol between the client lib and the server. tcpmon might help you. A debugger might help you. A profiler might help you as you can see what sort of methods get called.

Upvotes: 0

Related Questions