Skip to content

Instantly share code, notes, and snippets.

@zawadz88
Created May 7, 2018 16:51
Show Gist options
  • Select an option

  • Save zawadz88/9edc2e321a663741fe98ed00090ae3cb to your computer and use it in GitHub Desktop.

Select an option

Save zawadz88/9edc2e321a663741fe98ed00090ae3cb to your computer and use it in GitHub Desktop.
abstract class BaseReactiveUseCase(threadExecutor: ThreadExecutor,
postExecutionThread: PostExecutionThread) {
protected val threadExecutorScheduler: Scheduler = Schedulers.from(threadExecutor)
protected val postExecutionThreadScheduler: Scheduler = postExecutionThread.scheduler
private val disposables = CompositeDisposable()
open fun dispose() {
if (!disposables.isDisposed) {
disposables.dispose()
}
}
protected fun addDisposable(disposable: Disposable) {
disposables.add(checkNotNull(disposable, { "disposable cannot be null!" }))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment