557 lines
13 KiB
Smali
557 lines
13 KiB
Smali
.class public final Lorg/apache/commons/logging/impl/WeakHashtable;
|
|
.super Ljava/util/Hashtable;
|
|
.source "WeakHashtable.java"
|
|
|
|
|
|
# annotations
|
|
.annotation system Ldalvik/annotation/MemberClasses;
|
|
value = {
|
|
Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;,
|
|
Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;,
|
|
Lorg/apache/commons/logging/impl/WeakHashtable$Entry;
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field private static final MAX_CHANGES_BEFORE_PURGE:I = 0x64
|
|
|
|
.field private static final PARTIAL_PURGE_COUNT:I = 0xa
|
|
|
|
|
|
# instance fields
|
|
.field private changeCount:I
|
|
|
|
.field private queue:Ljava/lang/ref/ReferenceQueue;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/util/Hashtable;-><init>()V
|
|
|
|
.line 2
|
|
new-instance v0, Ljava/lang/ref/ReferenceQueue;
|
|
|
|
invoke-direct {v0}, Ljava/lang/ref/ReferenceQueue;-><init>()V
|
|
|
|
iput-object v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->queue:Ljava/lang/ref/ReferenceQueue;
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 3
|
|
iput v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->changeCount:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private purge()V
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->queue:Ljava/lang/ref/ReferenceQueue;
|
|
|
|
monitor-enter v0
|
|
|
|
.line 2
|
|
:goto_0
|
|
:try_start_0
|
|
iget-object v1, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->queue:Ljava/lang/ref/ReferenceQueue;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/ref/ReferenceQueue;->poll()Ljava/lang/ref/Reference;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
.line 3
|
|
invoke-static {v1}, Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;->access$400(Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;)Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-super {p0, v1}, Ljava/util/Hashtable;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_0
|
|
|
|
.line 4
|
|
:cond_0
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw v1
|
|
.end method
|
|
|
|
.method private purgeOne()V
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->queue:Ljava/lang/ref/ReferenceQueue;
|
|
|
|
monitor-enter v0
|
|
|
|
.line 2
|
|
:try_start_0
|
|
iget-object v1, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->queue:Ljava/lang/ref/ReferenceQueue;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/ref/ReferenceQueue;->poll()Ljava/lang/ref/Reference;
|
|
|
|
move-result-object v1
|
|
|
|
check-cast v1, Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
.line 3
|
|
invoke-static {v1}, Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;->access$400(Lorg/apache/commons/logging/impl/WeakHashtable$WeakKey;)Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-super {p0, v1}, Ljava/util/Hashtable;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
.line 4
|
|
:cond_0
|
|
monitor-exit v0
|
|
|
|
return-void
|
|
|
|
:catchall_0
|
|
move-exception v1
|
|
|
|
monitor-exit v0
|
|
:try_end_0
|
|
.catchall {:try_start_0 .. :try_end_0} :catchall_0
|
|
|
|
throw v1
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public containsKey(Ljava/lang/Object;)Z
|
|
.locals 2
|
|
|
|
.line 1
|
|
new-instance v0, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, p1, v1}, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;-><init>(Ljava/lang/Object;Lorg/apache/commons/logging/impl/WeakHashtable$1;)V
|
|
|
|
.line 2
|
|
invoke-super {p0, v0}, Ljava/util/Hashtable;->containsKey(Ljava/lang/Object;)Z
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public elements()Ljava/util/Enumeration;
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->elements()Ljava/util/Enumeration;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public entrySet()Ljava/util/Set;
|
|
.locals 6
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->entrySet()Ljava/util/Set;
|
|
|
|
move-result-object v0
|
|
|
|
.line 3
|
|
new-instance v1, Ljava/util/HashSet;
|
|
|
|
invoke-direct {v1}, Ljava/util/HashSet;-><init>()V
|
|
|
|
.line 4
|
|
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_0
|
|
:goto_0
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
.line 5
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Ljava/util/Map$Entry;
|
|
|
|
.line 6
|
|
invoke-interface {v2}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
check-cast v3, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
.line 7
|
|
invoke-static {v3}, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;->access$100(Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;)Ljava/lang/Object;
|
|
|
|
move-result-object v3
|
|
|
|
.line 8
|
|
invoke-interface {v2}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
if-eqz v3, :cond_0
|
|
|
|
.line 9
|
|
new-instance v4, Lorg/apache/commons/logging/impl/WeakHashtable$Entry;
|
|
|
|
const/4 v5, 0x0
|
|
|
|
invoke-direct {v4, v3, v2, v5}, Lorg/apache/commons/logging/impl/WeakHashtable$Entry;-><init>(Ljava/lang/Object;Ljava/lang/Object;Lorg/apache/commons/logging/impl/WeakHashtable$1;)V
|
|
|
|
.line 10
|
|
invoke-virtual {v1, v4}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-object v1
|
|
.end method
|
|
|
|
.method public get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
.locals 2
|
|
|
|
.line 1
|
|
new-instance v0, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, p1, v1}, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;-><init>(Ljava/lang/Object;Lorg/apache/commons/logging/impl/WeakHashtable$1;)V
|
|
|
|
.line 2
|
|
invoke-super {p0, v0}, Ljava/util/Hashtable;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public isEmpty()Z
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public keySet()Ljava/util/Set;
|
|
.locals 3
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->keySet()Ljava/util/Set;
|
|
|
|
move-result-object v0
|
|
|
|
.line 3
|
|
new-instance v1, Ljava/util/HashSet;
|
|
|
|
invoke-direct {v1}, Ljava/util/HashSet;-><init>()V
|
|
|
|
.line 4
|
|
invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object v0
|
|
|
|
:cond_0
|
|
:goto_0
|
|
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v2
|
|
|
|
if-eqz v2, :cond_1
|
|
|
|
.line 5
|
|
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
check-cast v2, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
.line 6
|
|
invoke-static {v2}, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;->access$100(Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;)Ljava/lang/Object;
|
|
|
|
move-result-object v2
|
|
|
|
if-eqz v2, :cond_0
|
|
|
|
.line 7
|
|
invoke-virtual {v1, v2}, Ljava/util/HashSet;->add(Ljava/lang/Object;)Z
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-object v1
|
|
.end method
|
|
|
|
.method public keys()Ljava/util/Enumeration;
|
|
.locals 2
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->keys()Ljava/util/Enumeration;
|
|
|
|
move-result-object v0
|
|
|
|
.line 3
|
|
new-instance v1, Lorg/apache/commons/logging/impl/WeakHashtable$1;
|
|
|
|
invoke-direct {v1, p0, v0}, Lorg/apache/commons/logging/impl/WeakHashtable$1;-><init>(Lorg/apache/commons/logging/impl/WeakHashtable;Ljava/util/Enumeration;)V
|
|
|
|
return-object v1
|
|
.end method
|
|
|
|
.method public put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
.locals 3
|
|
|
|
const-string v0, "Null keys are not allowed"
|
|
|
|
.line 1
|
|
invoke-static {p1, v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
const-string v0, "Null values are not allowed"
|
|
|
|
.line 2
|
|
invoke-static {p2, v0}, Ljava/util/Objects;->requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
.line 3
|
|
iget v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->changeCount:I
|
|
|
|
add-int/lit8 v1, v0, 0x1
|
|
|
|
iput v1, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->changeCount:I
|
|
|
|
const/16 v2, 0x64
|
|
|
|
if-le v0, v2, :cond_0
|
|
|
|
.line 4
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 5
|
|
iput v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->changeCount:I
|
|
|
|
goto :goto_0
|
|
|
|
.line 6
|
|
:cond_0
|
|
rem-int/lit8 v1, v1, 0xa
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
.line 7
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purgeOne()V
|
|
|
|
.line 8
|
|
:cond_1
|
|
:goto_0
|
|
new-instance v0, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
iget-object v1, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->queue:Ljava/lang/ref/ReferenceQueue;
|
|
|
|
const/4 v2, 0x0
|
|
|
|
invoke-direct {v0, p1, v1, v2}, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;-><init>(Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;Lorg/apache/commons/logging/impl/WeakHashtable$1;)V
|
|
|
|
.line 9
|
|
invoke-super {p0, v0, p2}, Ljava/util/Hashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public putAll(Ljava/util/Map;)V
|
|
.locals 2
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
.line 1
|
|
invoke-interface {p1}, Ljava/util/Map;->entrySet()Ljava/util/Set;
|
|
|
|
move-result-object p1
|
|
|
|
.line 2
|
|
invoke-interface {p1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
|
|
|
|
move-result-object p1
|
|
|
|
:goto_0
|
|
invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_0
|
|
|
|
.line 3
|
|
invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/util/Map$Entry;
|
|
|
|
.line 4
|
|
invoke-interface {v0}, Ljava/util/Map$Entry;->getKey()Ljava/lang/Object;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {p0, v1, v0}, Lorg/apache/commons/logging/impl/WeakHashtable;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
goto :goto_0
|
|
|
|
:cond_0
|
|
return-void
|
|
.end method
|
|
|
|
.method public rehash()V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->rehash()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
.locals 3
|
|
|
|
.line 1
|
|
iget v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->changeCount:I
|
|
|
|
add-int/lit8 v1, v0, 0x1
|
|
|
|
iput v1, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->changeCount:I
|
|
|
|
const/16 v2, 0x64
|
|
|
|
if-le v0, v2, :cond_0
|
|
|
|
.line 2
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
const/4 v0, 0x0
|
|
|
|
.line 3
|
|
iput v0, p0, Lorg/apache/commons/logging/impl/WeakHashtable;->changeCount:I
|
|
|
|
goto :goto_0
|
|
|
|
.line 4
|
|
:cond_0
|
|
rem-int/lit8 v1, v1, 0xa
|
|
|
|
if-nez v1, :cond_1
|
|
|
|
.line 5
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purgeOne()V
|
|
|
|
.line 6
|
|
:cond_1
|
|
:goto_0
|
|
new-instance v0, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, p1, v1}, Lorg/apache/commons/logging/impl/WeakHashtable$Referenced;-><init>(Ljava/lang/Object;Lorg/apache/commons/logging/impl/WeakHashtable$1;)V
|
|
|
|
invoke-super {p0, v0}, Ljava/util/Hashtable;->remove(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
return-object p1
|
|
.end method
|
|
|
|
.method public size()I
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->size()I
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public toString()Ljava/lang/String;
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public values()Ljava/util/Collection;
|
|
.locals 1
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lorg/apache/commons/logging/impl/WeakHashtable;->purge()V
|
|
|
|
.line 2
|
|
invoke-super {p0}, Ljava/util/Hashtable;->values()Ljava/util/Collection;
|
|
|
|
move-result-object v0
|
|
|
|
return-object v0
|
|
.end method
|