Skip to content

Need Scheduler Shutdown #1730

@blesa

Description

@blesa

Use of Schedulers.io() or Schedulers.computation() creates several executors (thread pools) which are never shutted down. Threads stay in memory until the whole JVM finishes. This causes memory leak warnings on Tomcat aplication server (while reloading web app). Maybe it also violates section 4.3 of Rx Design Guidelines (not sure about that).
There should be a method to gracefully terminate all schedulers and their executors (thread pools). I'd propose something like Schedulers.reset() (or .shutdown or .shutdownNow).
All default schedulers are now created in Schedulers class constructor and referenced from its final member variables. I think it should be changed and sequence like this should be possible:
Schedulers.io(); // singleton referencing schedulers is created, threads are running
Schedulers.reset(); // all executors are shutted down, threads are gone
...
Schedulers.io(); // a fresh new set of executors is initialized

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions