1 package com.github.davidmoten.rx; 2 3 import rx.Observable; 4 import rx.functions.Action0; 5 6 public class CloseableObservableWithReset<T> { 7 8 private final Observable<T> observable; 9 private final Action0 closeAction; 10 private final Action0 resetAction; 11 12 public CloseableObservableWithReset(Observable<T> observable, Action0 closeAction, Action0 resetAction) { 13 this.observable = observable; 14 this.closeAction = closeAction; 15 this.resetAction = resetAction; 16 } 17 18 public Observable<T> observable() { 19 return observable; 20 } 21 22 public void reset() { 23 resetAction.call(); 24 } 25 26 public void close() { 27 closeAction.call(); 28 } 29 30 }