LambdaObserver.smali 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. .class public final Lio/reactivex/internal/observers/LambdaObserver;
  2. .super Ljava/util/concurrent/atomic/AtomicReference;
  3. .source "LambdaObserver.java"
  4. # interfaces
  5. .implements Lio/reactivex/Observer;
  6. .implements Lio/reactivex/disposables/Disposable;
  7. # annotations
  8. .annotation system Ldalvik/annotation/Signature;
  9. value = {
  10. "<T:",
  11. "Ljava/lang/Object;",
  12. ">",
  13. "Ljava/util/concurrent/atomic/AtomicReference<",
  14. "Lio/reactivex/disposables/Disposable;",
  15. ">;",
  16. "Lio/reactivex/Observer<",
  17. "TT;>;",
  18. "Lio/reactivex/disposables/Disposable;"
  19. }
  20. .end annotation
  21. # static fields
  22. .field private static final serialVersionUID:J = -0x64a12a8486b15cccL
  23. # instance fields
  24. .field final onComplete:Lio/reactivex/functions/Action;
  25. .field final onError:Lio/reactivex/functions/Consumer;
  26. .annotation system Ldalvik/annotation/Signature;
  27. value = {
  28. "Lio/reactivex/functions/Consumer<",
  29. "-",
  30. "Ljava/lang/Throwable;",
  31. ">;"
  32. }
  33. .end annotation
  34. .end field
  35. .field final onNext:Lio/reactivex/functions/Consumer;
  36. .annotation system Ldalvik/annotation/Signature;
  37. value = {
  38. "Lio/reactivex/functions/Consumer<",
  39. "-TT;>;"
  40. }
  41. .end annotation
  42. .end field
  43. .field final onSubscribe:Lio/reactivex/functions/Consumer;
  44. .annotation system Ldalvik/annotation/Signature;
  45. value = {
  46. "Lio/reactivex/functions/Consumer<",
  47. "-",
  48. "Lio/reactivex/disposables/Disposable;",
  49. ">;"
  50. }
  51. .end annotation
  52. .end field
  53. # direct methods
  54. .method public constructor <init>(Lio/reactivex/functions/Consumer;Lio/reactivex/functions/Consumer;Lio/reactivex/functions/Action;Lio/reactivex/functions/Consumer;)V
  55. .locals 0
  56. .annotation system Ldalvik/annotation/Signature;
  57. value = {
  58. "(",
  59. "Lio/reactivex/functions/Consumer<",
  60. "-TT;>;",
  61. "Lio/reactivex/functions/Consumer<",
  62. "-",
  63. "Ljava/lang/Throwable;",
  64. ">;",
  65. "Lio/reactivex/functions/Action;",
  66. "Lio/reactivex/functions/Consumer<",
  67. "-",
  68. "Lio/reactivex/disposables/Disposable;",
  69. ">;)V"
  70. }
  71. .end annotation
  72. .line 36
  73. invoke-direct {p0}, Ljava/util/concurrent/atomic/AtomicReference;-><init>()V
  74. .line 37
  75. iput-object p1, p0, Lio/reactivex/internal/observers/LambdaObserver;->onNext:Lio/reactivex/functions/Consumer;
  76. .line 38
  77. iput-object p2, p0, Lio/reactivex/internal/observers/LambdaObserver;->onError:Lio/reactivex/functions/Consumer;
  78. .line 39
  79. iput-object p3, p0, Lio/reactivex/internal/observers/LambdaObserver;->onComplete:Lio/reactivex/functions/Action;
  80. .line 40
  81. iput-object p4, p0, Lio/reactivex/internal/observers/LambdaObserver;->onSubscribe:Lio/reactivex/functions/Consumer;
  82. return-void
  83. .end method
  84. # virtual methods
  85. .method public dispose()V
  86. .locals 0
  87. .line 95
  88. invoke-static {p0}, Lio/reactivex/internal/disposables/DisposableHelper;->dispose(Ljava/util/concurrent/atomic/AtomicReference;)Z
  89. return-void
  90. .end method
  91. .method public isDisposed()Z
  92. .locals 2
  93. .line 100
  94. invoke-virtual {p0}, Lio/reactivex/internal/observers/LambdaObserver;->get()Ljava/lang/Object;
  95. move-result-object v0
  96. sget-object v1, Lio/reactivex/internal/disposables/DisposableHelper;->DISPOSED:Lio/reactivex/internal/disposables/DisposableHelper;
  97. if-ne v0, v1, :cond_0
  98. const/4 v0, 0x1
  99. goto :goto_0
  100. :cond_0
  101. const/4 v0, 0x0
  102. :goto_0
  103. return v0
  104. .end method
  105. .method public onComplete()V
  106. .locals 1
  107. .line 82
  108. invoke-virtual {p0}, Lio/reactivex/internal/observers/LambdaObserver;->isDisposed()Z
  109. move-result v0
  110. if-nez v0, :cond_0
  111. .line 83
  112. sget-object v0, Lio/reactivex/internal/disposables/DisposableHelper;->DISPOSED:Lio/reactivex/internal/disposables/DisposableHelper;
  113. invoke-virtual {p0, v0}, Lio/reactivex/internal/observers/LambdaObserver;->lazySet(Ljava/lang/Object;)V
  114. .line 85
  115. :try_start_0
  116. iget-object v0, p0, Lio/reactivex/internal/observers/LambdaObserver;->onComplete:Lio/reactivex/functions/Action;
  117. invoke-interface {v0}, Lio/reactivex/functions/Action;->run()V
  118. :try_end_0
  119. .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
  120. goto :goto_0
  121. :catch_0
  122. move-exception v0
  123. .line 87
  124. invoke-static {v0}, Lio/reactivex/exceptions/Exceptions;->throwIfFatal(Ljava/lang/Throwable;)V
  125. .line 88
  126. invoke-static {v0}, Lio/reactivex/plugins/RxJavaPlugins;->onError(Ljava/lang/Throwable;)V
  127. :cond_0
  128. :goto_0
  129. return-void
  130. .end method
  131. .method public onError(Ljava/lang/Throwable;)V
  132. .locals 4
  133. .line 69
  134. invoke-virtual {p0}, Lio/reactivex/internal/observers/LambdaObserver;->isDisposed()Z
  135. move-result v0
  136. if-nez v0, :cond_0
  137. .line 70
  138. sget-object v0, Lio/reactivex/internal/disposables/DisposableHelper;->DISPOSED:Lio/reactivex/internal/disposables/DisposableHelper;
  139. invoke-virtual {p0, v0}, Lio/reactivex/internal/observers/LambdaObserver;->lazySet(Ljava/lang/Object;)V
  140. .line 72
  141. :try_start_0
  142. iget-object v0, p0, Lio/reactivex/internal/observers/LambdaObserver;->onError:Lio/reactivex/functions/Consumer;
  143. invoke-interface {v0, p1}, Lio/reactivex/functions/Consumer;->accept(Ljava/lang/Object;)V
  144. :try_end_0
  145. .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
  146. goto :goto_0
  147. :catch_0
  148. move-exception v0
  149. .line 74
  150. invoke-static {v0}, Lio/reactivex/exceptions/Exceptions;->throwIfFatal(Ljava/lang/Throwable;)V
  151. .line 75
  152. new-instance v1, Lio/reactivex/exceptions/CompositeException;
  153. const/4 v2, 0x2
  154. new-array v2, v2, [Ljava/lang/Throwable;
  155. const/4 v3, 0x0
  156. aput-object p1, v2, v3
  157. const/4 p1, 0x1
  158. aput-object v0, v2, p1
  159. invoke-direct {v1, v2}, Lio/reactivex/exceptions/CompositeException;-><init>([Ljava/lang/Throwable;)V
  160. invoke-static {v1}, Lio/reactivex/plugins/RxJavaPlugins;->onError(Ljava/lang/Throwable;)V
  161. :cond_0
  162. :goto_0
  163. return-void
  164. .end method
  165. .method public onNext(Ljava/lang/Object;)V
  166. .locals 1
  167. .annotation system Ldalvik/annotation/Signature;
  168. value = {
  169. "(TT;)V"
  170. }
  171. .end annotation
  172. .line 57
  173. invoke-virtual {p0}, Lio/reactivex/internal/observers/LambdaObserver;->isDisposed()Z
  174. move-result v0
  175. if-nez v0, :cond_0
  176. .line 59
  177. :try_start_0
  178. iget-object v0, p0, Lio/reactivex/internal/observers/LambdaObserver;->onNext:Lio/reactivex/functions/Consumer;
  179. invoke-interface {v0, p1}, Lio/reactivex/functions/Consumer;->accept(Ljava/lang/Object;)V
  180. :try_end_0
  181. .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
  182. goto :goto_0
  183. :catch_0
  184. move-exception p1
  185. .line 61
  186. invoke-static {p1}, Lio/reactivex/exceptions/Exceptions;->throwIfFatal(Ljava/lang/Throwable;)V
  187. .line 62
  188. invoke-virtual {p0, p1}, Lio/reactivex/internal/observers/LambdaObserver;->onError(Ljava/lang/Throwable;)V
  189. :cond_0
  190. :goto_0
  191. return-void
  192. .end method
  193. .method public onSubscribe(Lio/reactivex/disposables/Disposable;)V
  194. .locals 0
  195. .line 45
  196. invoke-static {p0, p1}, Lio/reactivex/internal/disposables/DisposableHelper;->setOnce(Ljava/util/concurrent/atomic/AtomicReference;Lio/reactivex/disposables/Disposable;)Z
  197. move-result p1
  198. if-eqz p1, :cond_0
  199. .line 47
  200. :try_start_0
  201. iget-object p1, p0, Lio/reactivex/internal/observers/LambdaObserver;->onSubscribe:Lio/reactivex/functions/Consumer;
  202. invoke-interface {p1, p0}, Lio/reactivex/functions/Consumer;->accept(Ljava/lang/Object;)V
  203. :try_end_0
  204. .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0
  205. goto :goto_0
  206. :catch_0
  207. move-exception p1
  208. .line 49
  209. invoke-static {p1}, Lio/reactivex/exceptions/Exceptions;->throwIfFatal(Ljava/lang/Throwable;)V
  210. .line 50
  211. invoke-virtual {p0, p1}, Lio/reactivex/internal/observers/LambdaObserver;->onError(Ljava/lang/Throwable;)V
  212. :cond_0
  213. :goto_0
  214. return-void
  215. .end method