title: RxAndroid - Kill a Single
body: <p>I'm a beginner with the RxJava. My problem is the next: From the <code>Presenter</code> I called a "<code>Single</code>" in the background thread, with a <code>AndroidS.mainThread()</code> observer. 
  When my Screen is onDestroyed then It calls the presenter's <code>OnViewDestroy</code>. This is a method for free up memories.</p>
  
  <p>In the Presenter I using <code>CompositeDisposable</code></p>
  
  <pre><code>protected CompositeDisposable compositeDisposable = new CompositeDisposable();
  </code></pre>
  
  <p>When my Activity is created, then I call this method: (presenter's method)</p>
  
  <pre><code>@Override
      public void loadLibrary() {
          compositeDisposable.add(repository.getLibraryName()
                  .subscribeOn(Schedulers.io())
                  .observeOn(AndroidSchedulers.mainThread())
                  .subscribeWith(new DisposableSingleObserver&lt;String&gt;() {
                      @Override
                      public void onSuccess(String libraryName) {
                          view.displayLibraryName(libraryName);
                      }
  
                      @Override
                      public void onError(Throwable e) {
                          view.displayLibraryNameError();
                      }
                  }));
      }
  </code></pre>
  
  <p>It works fine. 
  But when the activity is <code>destroyed</code>, then I clearing the <code>CompositeDisposable</code></p>
  
  <pre><code>@Override
  public void onViewDestroy() {
      super.onViewDestroy();
      compositeDisposable.clear();
  }
  </code></pre>
  
  <p>It's called. But, the <code>repository.getLibraryName()</code> still running in the background while it isn't finish. (I see the log is still logging.)</p>
  
  <pre><code>@Override
  public Single&lt;String&gt; getLibraryName() {
      return Single.fromCallable(() -&gt; {
          int i = 0;
          while(i != 55000){
              i++;
              Log.d("T","" + i);
          }
          return "Dummy";
      });
  }
  </code></pre>
  
  <p>It stops when <code>i == 55000</code>.
  There is any option to kill this process? <strong>Because the presenter is dead. Nobody will catch the result.</strong> </p>
  
  <p>Any suggestions? Thank you !</p>