doOnSubscribe is called on IO threaddoOnSubscribe gets called on main threadWhat is the difference between a process and a thread?“implements Runnable” vs “extends Thread” in JavaHow do I update the GUI from another thread?What is a daemon thread in Java?How to use threading in Python?Android “Only the original thread that created a view hierarchy can touch its views.”RxJava Observing on calling/subscribing threadSchedulers.io() not returning to main threadRxJava subscribeOn and observeOn not override the original Scheduler set before?Rxjava observeOn and subscribeOn in Retrofit

Lost Update Understanding

Carry vs Roll-Down on a zero-coupon IRS

Aesthetic proofs that involve Field Theory / Galois Theory

How to clarify between imagined sensations and "real" fantasy events?

Is there any relation/leak between two sections of LM358 op-amp?

How to say "cheat sheet" in French

Safe to use 220V electric clothes dryer when building has been bridged down to 110V?

Hilbert's hotel: why can't I repeat it infinitely many times?

Do wheelchair aircraft exist?

How do pilots align the HUD with their eyeballs?

Why solving a differentiated integral equation might eventually lead to erroneous solutions of the original problem?

Can anyone put a name to this Circle of Fifths observation?

Is it impolite to ask for an in-flight catalogue with no intention of buying?

Why does (inf + 0j)*1 evaluate to inf + nanj?

My manager quit. Should I agree to defer wage increase to accommodate budget concerns?

How can this Stack Exchange site have an animated favicon?

1, 2, 4, 8, 16, ... 33?

Hangman Game (YAHG)

Cut a cake into 3 equal portions with only a knife

Labview vs Matlab??Which one better for image processing?

Why does this image of Jupiter look so strange?

What exactly did this mechanic sabotage on the American Airlines 737, and how dangerous was it?

If an object moving in a circle experiences centripetal force, then doesn't it also experience centrifugal force, because of Newton's third law?

Should the average user with no special access rights be worried about SMS-based 2FA being theoretically interceptable?



doOnSubscribe is called on IO thread


doOnSubscribe gets called on main threadWhat is the difference between a process and a thread?“implements Runnable” vs “extends Thread” in JavaHow do I update the GUI from another thread?What is a daemon thread in Java?How to use threading in Python?Android “Only the original thread that created a view hierarchy can touch its views.”RxJava Observing on calling/subscribing threadSchedulers.io() not returning to main threadRxJava subscribeOn and observeOn not override the original Scheduler set before?Rxjava observeOn and subscribeOn in Retrofit






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have the following code:



checkZipCode.exec(it)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe
Timber.d("Main thread: $Looper.getMainLooper().isCurrentThread")
view.showLoading(true)

.doOnDispose view.showLoading(false)
.flatMapMaybe isZipValid ->
if (isZipValid)
userModel.zipCode = it.toString()
saveUser.exec(userModel)
autoSelectCityIfSingle.exec()
else
// TODO: Should show error here?
Maybe.empty()


.subscribe(...)


Logs are: Main thread: false



I thought that doOnSubscribe is called on the latest scheduler above it. Isn't it?










share|improve this question
































    0















    I have the following code:



    checkZipCode.exec(it)
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .doOnSubscribe
    Timber.d("Main thread: $Looper.getMainLooper().isCurrentThread")
    view.showLoading(true)

    .doOnDispose view.showLoading(false)
    .flatMapMaybe isZipValid ->
    if (isZipValid)
    userModel.zipCode = it.toString()
    saveUser.exec(userModel)
    autoSelectCityIfSingle.exec()
    else
    // TODO: Should show error here?
    Maybe.empty()


    .subscribe(...)


    Logs are: Main thread: false



    I thought that doOnSubscribe is called on the latest scheduler above it. Isn't it?










    share|improve this question




























      0












      0








      0


      0






      I have the following code:



      checkZipCode.exec(it)
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .doOnSubscribe
      Timber.d("Main thread: $Looper.getMainLooper().isCurrentThread")
      view.showLoading(true)

      .doOnDispose view.showLoading(false)
      .flatMapMaybe isZipValid ->
      if (isZipValid)
      userModel.zipCode = it.toString()
      saveUser.exec(userModel)
      autoSelectCityIfSingle.exec()
      else
      // TODO: Should show error here?
      Maybe.empty()


      .subscribe(...)


      Logs are: Main thread: false



      I thought that doOnSubscribe is called on the latest scheduler above it. Isn't it?










      share|improve this question
















      I have the following code:



      checkZipCode.exec(it)
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .doOnSubscribe
      Timber.d("Main thread: $Looper.getMainLooper().isCurrentThread")
      view.showLoading(true)

      .doOnDispose view.showLoading(false)
      .flatMapMaybe isZipValid ->
      if (isZipValid)
      userModel.zipCode = it.toString()
      saveUser.exec(userModel)
      autoSelectCityIfSingle.exec()
      else
      // TODO: Should show error here?
      Maybe.empty()


      .subscribe(...)


      Logs are: Main thread: false



      I thought that doOnSubscribe is called on the latest scheduler above it. Isn't it?







      android multithreading kotlin rx-java2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 28 at 17:18









      Dr Mido

      9456 silver badges35 bronze badges




      9456 silver badges35 bronze badges










      asked Mar 28 at 16:54









      int_32int_32

      5,88027 gold badges80 silver badges147 bronze badges




      5,88027 gold badges80 silver badges147 bronze badges

























          2 Answers
          2






          active

          oldest

          votes


















          2
















          The subscription execution path isn't really an emission that observeOn acts upon. See
          this question. If you really want to have something occur on the main thread in that spot in your chain, perhaps you can flatMap in another Observable that would do something within its doOnSubscribe (since that will occur on the emission thread, which is the main thread here).






          share|improve this answer
































            0
















            Well, doOnSubscribe is executed on the same thread with subscribe().



            I had problems because subscribe() was called on I/O thread.






            share|improve this answer



























              Your Answer






              StackExchange.ifUsing("editor", function ()
              StackExchange.using("externalEditor", function ()
              StackExchange.using("snippets", function ()
              StackExchange.snippets.init();
              );
              );
              , "code-snippets");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "1"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );














              draft saved

              draft discarded
















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403050%2fdoonsubscribe-is-called-on-io-thread%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2
















              The subscription execution path isn't really an emission that observeOn acts upon. See
              this question. If you really want to have something occur on the main thread in that spot in your chain, perhaps you can flatMap in another Observable that would do something within its doOnSubscribe (since that will occur on the emission thread, which is the main thread here).






              share|improve this answer





























                2
















                The subscription execution path isn't really an emission that observeOn acts upon. See
                this question. If you really want to have something occur on the main thread in that spot in your chain, perhaps you can flatMap in another Observable that would do something within its doOnSubscribe (since that will occur on the emission thread, which is the main thread here).






                share|improve this answer



























                  2














                  2










                  2









                  The subscription execution path isn't really an emission that observeOn acts upon. See
                  this question. If you really want to have something occur on the main thread in that spot in your chain, perhaps you can flatMap in another Observable that would do something within its doOnSubscribe (since that will occur on the emission thread, which is the main thread here).






                  share|improve this answer













                  The subscription execution path isn't really an emission that observeOn acts upon. See
                  this question. If you really want to have something occur on the main thread in that spot in your chain, perhaps you can flatMap in another Observable that would do something within its doOnSubscribe (since that will occur on the emission thread, which is the main thread here).







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Mar 28 at 17:07









                  Justin BreitfellerJustin Breitfeller

                  12.1k4 gold badges34 silver badges47 bronze badges




                  12.1k4 gold badges34 silver badges47 bronze badges


























                      0
















                      Well, doOnSubscribe is executed on the same thread with subscribe().



                      I had problems because subscribe() was called on I/O thread.






                      share|improve this answer





























                        0
















                        Well, doOnSubscribe is executed on the same thread with subscribe().



                        I had problems because subscribe() was called on I/O thread.






                        share|improve this answer



























                          0














                          0










                          0









                          Well, doOnSubscribe is executed on the same thread with subscribe().



                          I had problems because subscribe() was called on I/O thread.






                          share|improve this answer













                          Well, doOnSubscribe is executed on the same thread with subscribe().



                          I had problems because subscribe() was called on I/O thread.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 28 at 17:39









                          int_32int_32

                          5,88027 gold badges80 silver badges147 bronze badges




                          5,88027 gold badges80 silver badges147 bronze badges































                              draft saved

                              draft discarded















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55403050%2fdoonsubscribe-is-called-on-io-thread%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                              SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                              은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현