jimu-decompiled/sources/com/baidu/cloud/videocache/l.java
2025-05-13 19:24:51 +02:00

64 lines
1.4 KiB
Java

package com.baidu.cloud.videocache;
import java.net.Socket;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
/* loaded from: classes.dex */
final class l {
private final String b;
private volatile f c;
private final CacheListener e;
private final a f;
private final AtomicInteger a = new AtomicInteger(0);
private final List d = new CopyOnWriteArrayList();
public l(String str, a aVar) {
t.a(str);
this.b = str;
t.a(aVar);
this.f = aVar;
this.e = new m(str, this.d);
}
private synchronized void b() {
this.c = this.c == null ? d() : this.c;
}
private synchronized void c() {
if (this.a.decrementAndGet() <= 0) {
this.c.a();
this.c = null;
}
}
private f d() {
f a = y.a(this.b, this.f);
a.a(this.e);
return a;
}
public int a() {
return this.a.get();
}
public void a(CacheListener cacheListener) {
this.d.add(cacheListener);
}
public void a(b bVar, Socket socket) {
b();
try {
this.a.incrementAndGet();
this.c.a(bVar, socket);
} finally {
c();
}
}
public void b(CacheListener cacheListener) {
this.d.remove(cacheListener);
}
}