February 2020
Intermediate to advanced
412 pages
9h 36m
English
Up until this point, we have used a sleep() method to keep concurrent reactive applications from quitting prematurely, just long enough for an Observable to complete all emissions. 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 a long-running or infinite Observable, you may have to keep the main thread alive for a period of 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() ...
Read now
Unlock full access