'When to use .dispose()
I have a blocking context that subscribes to Observable.(I know it is a bad practice, but that is how it is)
publis String someMethod(List<Entity> data) {
save(data);
return "success";
}
public void save(List<Entity> entities) {
Observable.fromIterable(entities)
.forEach(entity -> repository.save(entity));//as I understood forEach will automatically subscribe
}
I have heard that you can do .dispose() to release threads, but not sure if I must do it here and if I do, shall I just dispose or do some checks before? Or maybe I should just use .block instead?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
