code: public static Disposable unsubscribeInEventDispatchThread(final Runnable unsubscribe) {
          return Disposables.fromRunnable(() -> {
              if (Platform.isFxApplicationThread()) {
                  unsubscribe.run();
              } else {
                  final Scheduler.Worker inner = JavaFxScheduler.platform().createWorker();
                  inner.schedule(() -> {
                      unsubscribe.run();
                      inner.dispose();
                  });
              }
          });
      }
docs: Create a Disposable that always runs <code>unsubscribe</code> in the event dispatch thread.
  
  @param unsubscribe the runnable to be performed in the ui thread at un-subscription
  @return an Disposable that always runs <code>unsubscribe</code> in the event dispatch thread.