June 2017
Intermediate to advanced
400 pages
8h 44m
English
Up until this point, we have used a sleep() method to keep concurrent reactive applications from quitting prematurely, just long enough for the Observables to fire. If you are using Android, JavaFX, or other frameworks that manage their own non-daemon threads, this is not a concern as the application will be kept alive for you. But if you are simply firing off a program with a main() method and you want to kick off long-running or infinite Observables, you may have to keep the main thread alive for a period longer than 5-20 seconds. Sometimes, you may want to keep it alive indefinitely.
One way to keep an application alive indefinitely is to simply pass Long.MAX_VALUE to the Thread.sleep() method, as shown in ...
Read now
Unlock full access