I think I've been doing RMI wrong this whole time.
MODIFY
runtime/src/jycessing/mode/run/RMIUtils.java
runtime/src/jycessing/mode/run/RMIUtils.java
@@ -109,9 +109,9 @@ public class RMIUtils {
}
}
- public static Remote export(final Remote remote) throws RMIProblem {
+ public static void export(final Remote remote) throws RMIProblem {
try {
- return UnicastRemoteObject.exportObject(remote, 0);
+ UnicastRemoteObject.exportObject(remote, 0);
} catch (final RemoteException e) {
throw new RMIProblem(e);
}

MODIFY
runtime/src/jycessing/mode/run/SketchRunner.java
runtime/src/jycessing/mode/run/SketchRunner.java
@@ -205,9 +205,9 @@ public class SketchRunner implements SketchService {
private static void launch(final String id, final ModeService modeService)
throws RMIProblem, RemoteException {
final SketchRunner sketchRunner = new SketchRunner(id, modeService);
- final SketchService stub = (SketchService)RMIUtils.export(sketchRunner);
+ RMIUtils.export(sketchRunner);
log("Calling mode's handleReady().");
- modeService.handleReady(id, stub);
+ modeService.handleReady(id, sketchRunner);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
log("Exiting; telling modeService.");
try {

MODIFY
runtime/src/jycessing/mode/run/SketchServiceManager.java
runtime/src/jycessing/mode/run/SketchServiceManager.java
@@ -63,9 +63,8 @@ public class SketchServiceManager implements ModeService {
isStarted = true;
try {
if (PythonMode.SKETCH_RUNNER_FIRST) {
- final ModeService stub = (ModeService) RMIUtils.export(this);
- final ModeWaiter modeWaiter = RMIUtils.lookup(ModeWaiter.class);
- modeWaiter.modeReady(stub);
+ RMIUtils.export(this);
+ RMIUtils.lookup(ModeWaiter.class).modeReady(this);
} else {
RMIUtils.bind(this, ModeService.class);
}

I think I've been doing RMI wrong this whole time.