alexandroid/decompiled/jadx/sources/org/apache/http/pool/PoolEntry.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

114 lines
3.2 KiB
Java

package org.apache.http.pool;
import androidx.biometric.ErrorUtils$$ExternalSyntheticOutline0;
import com.amazon.alexa.ra.core.ui.markdown.parser.formatter.MarkdownConstants;
import java.util.concurrent.TimeUnit;
import org.apache.http.annotation.Contract;
import org.apache.http.annotation.ThreadingBehavior;
import org.apache.http.util.Args;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL)
/* loaded from: classes11.dex */
public abstract class PoolEntry<T, C> {
private final C conn;
private final long created;
private long expiry;
private final String id;
private final T route;
private volatile Object state;
private long updated;
private final long validityDeadline;
public PoolEntry(String str, T t, C c, long j, TimeUnit timeUnit) {
Args.notNull(t, "Route");
Args.notNull(c, "Connection");
Args.notNull(timeUnit, "Time unit");
this.id = str;
this.route = t;
this.conn = c;
long currentTimeMillis = System.currentTimeMillis();
this.created = currentTimeMillis;
this.updated = currentTimeMillis;
if (j > 0) {
long millis = timeUnit.toMillis(j) + currentTimeMillis;
this.validityDeadline = millis > 0 ? millis : Long.MAX_VALUE;
} else {
this.validityDeadline = Long.MAX_VALUE;
}
this.expiry = this.validityDeadline;
}
public abstract void close();
public C getConnection() {
return this.conn;
}
public long getCreated() {
return this.created;
}
public synchronized long getExpiry() {
return this.expiry;
}
public String getId() {
return this.id;
}
public T getRoute() {
return this.route;
}
public Object getState() {
return this.state;
}
public synchronized long getUpdated() {
return this.updated;
}
@Deprecated
public long getValidUnit() {
return this.validityDeadline;
}
public long getValidityDeadline() {
return this.validityDeadline;
}
public abstract boolean isClosed();
public synchronized boolean isExpired(long j) {
return j >= this.expiry;
}
public void setState(Object obj) {
this.state = obj;
}
public String toString() {
StringBuilder sb = new StringBuilder("[id:");
sb.append(this.id);
sb.append("][route:");
sb.append(this.route);
sb.append("][state:");
return ErrorUtils$$ExternalSyntheticOutline0.m(sb, MarkdownConstants.RIGHT_BRACKET, this.state);
}
public synchronized void updateExpiry(long j, TimeUnit timeUnit) {
try {
Args.notNull(timeUnit, "Time unit");
long currentTimeMillis = System.currentTimeMillis();
this.updated = currentTimeMillis;
this.expiry = Math.min(j > 0 ? currentTimeMillis + timeUnit.toMillis(j) : Long.MAX_VALUE, this.validityDeadline);
} catch (Throwable th) {
throw th;
}
}
public PoolEntry(String str, T t, C c) {
this(str, t, c, 0L, TimeUnit.MILLISECONDS);
}
}