|IPC, Dirmi, BridgeClassloader [message #1137210]
||Mon, 14 October 2013 10:35
| Marek Jagielski
Registered: April 2012
I am trying to establish an inter-process communication between eclipse plugin and a separate java process launched within eclipse. I found a library Dirmi (https://github.com/cojen/Dirmi) as a good and light solution that would fit my needs. It is bidirectional and it says that it is faster than standard rmi.
During integration test I met some difficulties. As dirmi is working fine in standalone environemnt, I can't simply run it in Eclipse PDE. (Here is an issue that I made in dirmi project: https://github.com/cojen/Dirmi/issues/2). To demonstrate a problem I created a sample project: https://github.com/marekjagielski/eclipse-launcher-with-dirmi-server.
Dirmi is a library that uses runtime code generation. When I use it I get an exception:
java.lang.ClassCastException: com.systemincloud.modeler.launch.impl.common.ConsoleIApi$Stub$163 cannot be cast to com.systemincloud.modeler.launch.impl.common.ConsoleIApi
It can be due to the fact that at runtime each bundle has its own classloader. Someone has already provided a patch for dirmi: https://github.com/cojen/Dirmi/commit/c5809e090b83d41cb54cb6c9c696737a8fbb0393
In the commit message he explains the problem and that the solution is to use Bridge classloading. Only using a patch didn't solve my problem. However, in the explanation there is a sentence that I don't fully understand:
"The solution is to generate a bridge classloader for each application bundle classloader that simply delegates to the application bundle classloader, except when loading classes that starts with "org.cojen.dirmi" in which case it delegates to the Dirmi bundle classloader."
I don't undestand how can I replace a class loader for a plugin?
Thanks in advance,
Powered by FUDForum
. Page generated in 0.02622 seconds