721 lines
24 KiB
Smali
721 lines
24 KiB
Smali
.class Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;
|
|
.super Lcom/facebook/datasource/AbstractDataSource;
|
|
.source "FirstAvailableDataSourceSupplier.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/EnclosingClass;
|
|
value = Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/InnerClass;
|
|
accessFlags = 0x2
|
|
name = "FirstAvailableDataSource"
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource$InternalDataSubscriber;
|
|
}
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/facebook/datasource/AbstractDataSource",
|
|
"<TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation build Ljavax/annotation/concurrent/ThreadSafe;
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
.field private mIndex:I
|
|
|
|
.field final synthetic this$0:Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>(Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;)V
|
|
.locals 2
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
const/4 v1, 0x0
|
|
|
|
iput-object p1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->this$0:Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;
|
|
|
|
invoke-direct {p0}, Lcom/facebook/datasource/AbstractDataSource;-><init>()V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
iput v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mIndex:I
|
|
|
|
iput-object v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
|
|
iput-object v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
|
|
invoke-direct {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->startNextDataSource()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
new-instance v0, Ljava/lang/RuntimeException;
|
|
|
|
const-string v1, "No data source supplier or supplier returned null."
|
|
|
|
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p0, v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->setFailure(Ljava/lang/Throwable;)Z
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method static synthetic access$200(Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;Lcom/facebook/datasource/DataSource;)V
|
|
.locals 0
|
|
.param p0, "x0" # Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;
|
|
.param p1, "x1" # Lcom/facebook/datasource/DataSource;
|
|
|
|
.prologue
|
|
invoke-direct {p0, p1}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->onDataSourceFailed(Lcom/facebook/datasource/DataSource;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method static synthetic access$300(Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;Lcom/facebook/datasource/DataSource;)V
|
|
.locals 0
|
|
.param p0, "x0" # Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;
|
|
.param p1, "x1" # Lcom/facebook/datasource/DataSource;
|
|
|
|
.prologue
|
|
invoke-direct {p0, p1}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->onDataSourceNewResult(Lcom/facebook/datasource/DataSource;)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private declared-synchronized clearCurrentDataSource(Lcom/facebook/datasource/DataSource;)Z
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;)Z"
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
.local p1, "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->isClosed()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
iget-object v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
if-eq p1, v0, :cond_1
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
monitor-exit p0
|
|
|
|
return v0
|
|
|
|
:cond_1
|
|
const/4 v0, 0x0
|
|
|
|
:try_start_1
|
|
iput-object v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
monitor-exit p0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method private closeSafely(Lcom/facebook/datasource/DataSource;)V
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
.local p1, "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
if-eqz p1, :cond_0
|
|
|
|
invoke-interface {p1}, Lcom/facebook/datasource/DataSource;->close()Z
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method private declared-synchronized getDataSourceWithResult()Lcom/facebook/datasource/DataSource;
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
iget-object v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
monitor-exit p0
|
|
|
|
return-object v0
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
monitor-exit p0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method private declared-synchronized getNextSupplier()Lcom/facebook/common/internal/Supplier;
|
|
.locals 3
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Lcom/facebook/common/internal/Supplier",
|
|
"<",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;>;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->isClosed()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
iget v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mIndex:I
|
|
|
|
iget-object v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->this$0:Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;
|
|
|
|
invoke-static {v1}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;->access$100(Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;)Ljava/util/List;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-interface {v1}, Ljava/util/List;->size()I
|
|
|
|
move-result v1
|
|
|
|
if-ge v0, v1, :cond_0
|
|
|
|
iget-object v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->this$0:Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;
|
|
|
|
invoke-static {v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;->access$100(Lcom/facebook/datasource/FirstAvailableDataSourceSupplier;)Ljava/util/List;
|
|
|
|
move-result-object v0
|
|
|
|
iget v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mIndex:I
|
|
|
|
add-int/lit8 v2, v1, 0x1
|
|
|
|
iput v2, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mIndex:I
|
|
|
|
invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Lcom/facebook/common/internal/Supplier;
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
:goto_0
|
|
monitor-exit p0
|
|
|
|
return-object v0
|
|
|
|
:cond_0
|
|
const/4 v0, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
monitor-exit p0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method private maybeSetDataSourceWithResult(Lcom/facebook/datasource/DataSource;Z)V
|
|
.locals 2
|
|
.param p2, "isFinished" # Z
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;Z)V"
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
.local p1, "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
const/4 v0, 0x0
|
|
|
|
.local v0, "oldDataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
iget-object v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
|
|
if-ne p1, v1, :cond_0
|
|
|
|
iget-object v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
|
|
if-ne p1, v1, :cond_1
|
|
|
|
:cond_0
|
|
monitor-exit p0
|
|
|
|
:goto_0
|
|
return-void
|
|
|
|
:cond_1
|
|
iget-object v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
|
|
if-eqz v1, :cond_2
|
|
|
|
if-eqz p2, :cond_3
|
|
|
|
:cond_2
|
|
iget-object v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
|
|
iput-object p1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
|
|
:cond_3
|
|
monitor-exit p0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-direct {p0, v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->closeSafely(Lcom/facebook/datasource/DataSource;)V
|
|
|
|
goto :goto_0
|
|
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
:try_start_1
|
|
monitor-exit p0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw v1
|
|
.end method
|
|
|
|
.method private onDataSourceFailed(Lcom/facebook/datasource/DataSource;)V
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
.local p1, "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
invoke-direct {p0, p1}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->clearCurrentDataSource(Lcom/facebook/datasource/DataSource;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_1
|
|
|
|
:cond_0
|
|
:goto_0
|
|
return-void
|
|
|
|
:cond_1
|
|
invoke-direct {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->getDataSourceWithResult()Lcom/facebook/datasource/DataSource;
|
|
|
|
move-result-object v0
|
|
|
|
if-eq p1, v0, :cond_2
|
|
|
|
invoke-direct {p0, p1}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->closeSafely(Lcom/facebook/datasource/DataSource;)V
|
|
|
|
:cond_2
|
|
invoke-direct {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->startNextDataSource()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
invoke-interface {p1}, Lcom/facebook/datasource/DataSource;->getFailureCause()Ljava/lang/Throwable;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->setFailure(Ljava/lang/Throwable;)Z
|
|
|
|
goto :goto_0
|
|
.end method
|
|
|
|
.method private onDataSourceNewResult(Lcom/facebook/datasource/DataSource;)V
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;)V"
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
.local p1, "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
invoke-interface {p1}, Lcom/facebook/datasource/DataSource;->isFinished()Z
|
|
|
|
move-result v0
|
|
|
|
invoke-direct {p0, p1, v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->maybeSetDataSourceWithResult(Lcom/facebook/datasource/DataSource;Z)V
|
|
|
|
invoke-direct {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->getDataSourceWithResult()Lcom/facebook/datasource/DataSource;
|
|
|
|
move-result-object v0
|
|
|
|
if-ne p1, v0, :cond_0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
invoke-interface {p1}, Lcom/facebook/datasource/DataSource;->isFinished()Z
|
|
|
|
move-result v1
|
|
|
|
invoke-virtual {p0, v0, v1}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->setResult(Ljava/lang/Object;Z)Z
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method private declared-synchronized setCurrentDataSource(Lcom/facebook/datasource/DataSource;)Z
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Lcom/facebook/datasource/DataSource",
|
|
"<TT;>;)Z"
|
|
}
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
.local p1, "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
invoke-virtual {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->isClosed()Z
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
const/4 v0, 0x0
|
|
|
|
:goto_0
|
|
monitor-exit p0
|
|
|
|
return v0
|
|
|
|
:cond_0
|
|
:try_start_1
|
|
iput-object p1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
const/4 v0, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:catchall_0
|
|
move-exception v0
|
|
|
|
monitor-exit p0
|
|
|
|
throw v0
|
|
.end method
|
|
|
|
.method private startNextDataSource()Z
|
|
.locals 4
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
const/4 v3, 0x0
|
|
|
|
invoke-direct {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->getNextSupplier()Lcom/facebook/common/internal/Supplier;
|
|
|
|
move-result-object v1
|
|
|
|
.local v1, "dataSourceSupplier":Lcom/facebook/common/internal/Supplier;, "Lcom/facebook/common/internal/Supplier<Lcom/facebook/datasource/DataSource<TT;>;>;"
|
|
if-eqz v1, :cond_0
|
|
|
|
invoke-interface {v1}, Lcom/facebook/common/internal/Supplier;->get()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Lcom/facebook/datasource/DataSource;
|
|
|
|
move-object v0, v2
|
|
|
|
.local v0, "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
:goto_0
|
|
invoke-direct {p0, v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->setCurrentDataSource(Lcom/facebook/datasource/DataSource;)Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
new-instance v2, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource$InternalDataSubscriber;
|
|
|
|
invoke-direct {v2, p0, v3}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource$InternalDataSubscriber;-><init>(Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$1;)V
|
|
|
|
invoke-static {}, Lcom/facebook/common/executors/CallerThreadExecutor;->getInstance()Lcom/facebook/common/executors/CallerThreadExecutor;
|
|
|
|
move-result-object v3
|
|
|
|
invoke-interface {v0, v2, v3}, Lcom/facebook/datasource/DataSource;->subscribe(Lcom/facebook/datasource/DataSubscriber;Ljava/util/concurrent/Executor;)V
|
|
|
|
const/4 v2, 0x1
|
|
|
|
:goto_1
|
|
return v2
|
|
|
|
.end local v0 # "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
:cond_0
|
|
move-object v0, v3
|
|
|
|
goto :goto_0
|
|
|
|
.restart local v0 # "dataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
:cond_1
|
|
invoke-direct {p0, v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->closeSafely(Lcom/facebook/datasource/DataSource;)V
|
|
|
|
const/4 v2, 0x0
|
|
|
|
goto :goto_1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public close()Z
|
|
.locals 3
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
invoke-super {p0}, Lcom/facebook/datasource/AbstractDataSource;->close()Z
|
|
|
|
move-result v2
|
|
|
|
if-nez v2, :cond_0
|
|
|
|
const/4 v2, 0x0
|
|
|
|
monitor-exit p0
|
|
|
|
:goto_0
|
|
return v2
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
|
|
.local v0, "currentDataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
const/4 v2, 0x0
|
|
|
|
iput-object v2, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mCurrentDataSource:Lcom/facebook/datasource/DataSource;
|
|
|
|
iget-object v1, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
|
|
.local v1, "dataSourceWithResult":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
const/4 v2, 0x0
|
|
|
|
iput-object v2, p0, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->mDataSourceWithResult:Lcom/facebook/datasource/DataSource;
|
|
|
|
monitor-exit p0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
invoke-direct {p0, v1}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->closeSafely(Lcom/facebook/datasource/DataSource;)V
|
|
|
|
invoke-direct {p0, v0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->closeSafely(Lcom/facebook/datasource/DataSource;)V
|
|
|
|
const/4 v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
.end local v0 # "currentDataSource":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
.end local v1 # "dataSourceWithResult":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
:catchall_0
|
|
move-exception v2
|
|
|
|
:try_start_1
|
|
monitor-exit p0
|
|
:try_end_1
|
|
.catchall {:try_start_1 .. :try_end_1} :catchall_0
|
|
|
|
throw v2
|
|
.end method
|
|
|
|
.method public declared-synchronized getResult()Ljava/lang/Object;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()TT;"
|
|
}
|
|
.end annotation
|
|
|
|
.annotation runtime Ljavax/annotation/Nullable;
|
|
.end annotation
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
invoke-direct {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->getDataSourceWithResult()Lcom/facebook/datasource/DataSource;
|
|
|
|
move-result-object v0
|
|
|
|
.local v0, "dataSourceWithResult":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
if-eqz v0, :cond_0
|
|
|
|
invoke-interface {v0}, Lcom/facebook/datasource/DataSource;->getResult()Ljava/lang/Object;
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
move-result-object v1
|
|
|
|
:goto_0
|
|
monitor-exit p0
|
|
|
|
return-object v1
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
.end local v0 # "dataSourceWithResult":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
monitor-exit p0
|
|
|
|
throw v1
|
|
.end method
|
|
|
|
.method public declared-synchronized hasResult()Z
|
|
.locals 2
|
|
|
|
.prologue
|
|
.local p0, "this":Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;, "Lcom/facebook/datasource/FirstAvailableDataSourceSupplier<TT;>.FirstAvailableDataSource;"
|
|
monitor-enter p0
|
|
|
|
:try_start_0
|
|
invoke-direct {p0}, Lcom/facebook/datasource/FirstAvailableDataSourceSupplier$FirstAvailableDataSource;->getDataSourceWithResult()Lcom/facebook/datasource/DataSource;
|
|
|
|
move-result-object v0
|
|
|
|
.local v0, "dataSourceWithResult":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
if-eqz v0, :cond_0
|
|
|
|
invoke-interface {v0}, Lcom/facebook/datasource/DataSource;->hasResult()Z
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
const/4 v1, 0x1
|
|
|
|
:goto_0
|
|
monitor-exit p0
|
|
|
|
return v1
|
|
|
|
:cond_0
|
|
const/4 v1, 0x0
|
|
|
|
goto :goto_0
|
|
|
|
.end local v0 # "dataSourceWithResult":Lcom/facebook/datasource/DataSource;, "Lcom/facebook/datasource/DataSource<TT;>;"
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
monitor-exit p0
|
|
|
|
throw v1
|
|
.end method
|