Java RMI with Scala, is this possible?

Java RMI -Remote Method Invocation - Java only for Java.

On the Scala website, I read that integrating with Java is seamless and that:

Scala programs running in the Java virtual machine are Java compatible bytecodes, so you can make full use of existing Java libraries or existing application code. You can call Scala from Java, and you can call Java from Scala, the integration is seamless.

Does this mean that I can successfully use Java for Scala RMI?

Has anyone experimented with this first hand?

EDIT:

Any known or discovered gotchas?

+6
source share
3 answers

Yes, here is a link to the message flow, where it looks like someone did it . It says:

Yes it is possible! Thanks for the help. Now I have a small pair of RMI-based Scala programs that will transfer documents from one Documentum system to another (previous version); Scala code interacts very well with Documentum Java libraries.

Figuring out how to get method signatures, including throws RemoteException , seems to be the biggest hurdle.

+5
source

Yes, it can be done. The rmi compiler works with java byte code, so the language used does not really matter. I did this for a class project.

+1
source

It will depend on which RMI library you are using, but the answer is β€œYes” in general. Note that if you write a method that returns (for example) a Scala collection, for example scala.collections.immutable.List , then your Java code will probably not be able to convert it to java.util.List .

0
source

Source: https://habr.com/ru/post/893169/


All Articles