BlockingBaseSubscriber.smali 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. .class public abstract Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;
  2. .super Ljava/util/concurrent/CountDownLatch;
  3. .source "BlockingBaseSubscriber.java"
  4. # interfaces
  5. .implements Lorg/reactivestreams/Subscriber;
  6. # annotations
  7. .annotation system Ldalvik/annotation/Signature;
  8. value = {
  9. "<T:",
  10. "Ljava/lang/Object;",
  11. ">",
  12. "Ljava/util/concurrent/CountDownLatch;",
  13. "Lorg/reactivestreams/Subscriber<",
  14. "TT;>;"
  15. }
  16. .end annotation
  17. # instance fields
  18. .field volatile cancelled:Z
  19. .field error:Ljava/lang/Throwable;
  20. .field s:Lorg/reactivestreams/Subscription;
  21. .field value:Ljava/lang/Object;
  22. .annotation system Ldalvik/annotation/Signature;
  23. value = {
  24. "TT;"
  25. }
  26. .end annotation
  27. .end field
  28. # direct methods
  29. .method public constructor <init>()V
  30. .locals 1
  31. const/4 v0, 0x1
  32. .line 33
  33. invoke-direct {p0, v0}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V
  34. return-void
  35. .end method
  36. # virtual methods
  37. .method public final blockingGet()Ljava/lang/Object;
  38. .locals 5
  39. .annotation system Ldalvik/annotation/Signature;
  40. value = {
  41. "()TT;"
  42. }
  43. .end annotation
  44. .line 61
  45. invoke-virtual {p0}, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->getCount()J
  46. move-result-wide v0
  47. const-wide/16 v2, 0x0
  48. cmp-long v4, v0, v2
  49. if-eqz v4, :cond_1
  50. .line 63
  51. :try_start_0
  52. invoke-static {}, Lio/reactivex/internal/util/BlockingHelper;->verifyNonBlocking()V
  53. .line 64
  54. invoke-virtual {p0}, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->await()V
  55. :try_end_0
  56. .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0
  57. goto :goto_0
  58. :catch_0
  59. move-exception v0
  60. .line 66
  61. iget-object v1, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->s:Lorg/reactivestreams/Subscription;
  62. .line 67
  63. sget-object v2, Lio/reactivex/internal/subscriptions/SubscriptionHelper;->CANCELLED:Lio/reactivex/internal/subscriptions/SubscriptionHelper;
  64. iput-object v2, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->s:Lorg/reactivestreams/Subscription;
  65. if-eqz v1, :cond_0
  66. .line 69
  67. invoke-interface {v1}, Lorg/reactivestreams/Subscription;->cancel()V
  68. .line 71
  69. :cond_0
  70. invoke-static {v0}, Lio/reactivex/internal/util/ExceptionHelper;->wrapOrThrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;
  71. move-result-object v0
  72. throw v0
  73. .line 75
  74. :cond_1
  75. :goto_0
  76. iget-object v0, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->error:Ljava/lang/Throwable;
  77. if-nez v0, :cond_2
  78. .line 79
  79. iget-object v0, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->value:Ljava/lang/Object;
  80. return-object v0
  81. .line 77
  82. :cond_2
  83. invoke-static {v0}, Lio/reactivex/internal/util/ExceptionHelper;->wrapOrThrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException;
  84. move-result-object v0
  85. throw v0
  86. .end method
  87. .method public final onComplete()V
  88. .locals 0
  89. .line 52
  90. invoke-virtual {p0}, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->countDown()V
  91. return-void
  92. .end method
  93. .method public final onSubscribe(Lorg/reactivestreams/Subscription;)V
  94. .locals 2
  95. .line 38
  96. iget-object v0, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->s:Lorg/reactivestreams/Subscription;
  97. invoke-static {v0, p1}, Lio/reactivex/internal/subscriptions/SubscriptionHelper;->validate(Lorg/reactivestreams/Subscription;Lorg/reactivestreams/Subscription;)Z
  98. move-result v0
  99. if-eqz v0, :cond_0
  100. .line 39
  101. iput-object p1, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->s:Lorg/reactivestreams/Subscription;
  102. .line 40
  103. iget-boolean v0, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->cancelled:Z
  104. if-nez v0, :cond_0
  105. const-wide v0, 0x7fffffffffffffffL
  106. .line 41
  107. invoke-interface {p1, v0, v1}, Lorg/reactivestreams/Subscription;->request(J)V
  108. .line 42
  109. iget-boolean v0, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->cancelled:Z
  110. if-eqz v0, :cond_0
  111. .line 43
  112. sget-object v0, Lio/reactivex/internal/subscriptions/SubscriptionHelper;->CANCELLED:Lio/reactivex/internal/subscriptions/SubscriptionHelper;
  113. iput-object v0, p0, Lio/reactivex/internal/subscribers/BlockingBaseSubscriber;->s:Lorg/reactivestreams/Subscription;
  114. .line 44
  115. invoke-interface {p1}, Lorg/reactivestreams/Subscription;->cancel()V
  116. :cond_0
  117. return-void
  118. .end method