discord-jadx/app/src/main/java/lombok/core/CleanupRegistry.java

51 lines
1.6 KiB
Java

package lombok.core;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/* loaded from: com.discord-118107.apk:lombok/core/CleanupRegistry.SCL.lombok */
public class CleanupRegistry {
private final ConcurrentMap<CleanupKey, CleanupTask> tasks = new ConcurrentHashMap();
/* loaded from: com.discord-118107.apk:lombok/core/CleanupRegistry$CleanupKey.SCL.lombok */
private static final class CleanupKey {
private final String key;
private final Object target;
CleanupKey(String str, Object obj) {
this.key = str;
this.target = obj;
}
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (!(obj instanceof CleanupKey)) {
return false;
}
CleanupKey cleanupKey = (CleanupKey) obj;
return this.key.equals(cleanupKey.key) && this.target == cleanupKey.target;
}
public int hashCode() {
return (109 * System.identityHashCode(this.target)) + this.key.hashCode();
}
}
public void registerTask(String str, Object obj, CleanupTask cleanupTask) {
this.tasks.putIfAbsent(new CleanupKey(str, obj), cleanupTask);
}
public void run() {
Iterator<CleanupTask> it = this.tasks.values().iterator();
while (it.hasNext()) {
it.next().cleanup();
}
this.tasks.clear();
}
}