Of course, there should exist a respective Java class in the classpath for the deserialization to work and the custom Java Object to be created: j4rs

Search code, repositories, users, issues, pull requests...

submited by
Style Pass
2024-09-26 20:30:05

Of course, there should exist a respective Java class in the classpath for the deserialization to work and the custom Java Object to be created:

j4rs supports .async/.await viaJvm::invoke_async function. The function returns a Future, which is completed via the Receiver of a oneshot channel.

In Java side, the methods that can be invoked by invoke_async, must return a Java Future. When the Java Future completes, the Java side of j4rs invokes native Rust code that completes the pending Rust Future with either success or failure, using the Sender of the oneshot channel that was created when the invoke_async was called.

Please note that it is better for the Java methods that are invoked by the invoke_async function to return a CompletableFuture, as this improves performance.

j4rs handles simple Java Futures that are not CompletableFutures with polling, using an internal one-threaded ScheduledExecutorService.

Leave a Comment