2022-03-01 22:12:19 +00:00
|
|
|
package lombok.core;
|
|
|
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
import java.util.concurrent.ConcurrentMap;
|
2022-03-08 19:25:03 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/CleanupRegistry.SCL.lombok */
|
2022-03-01 22:12:19 +00:00
|
|
|
public class CleanupRegistry {
|
|
|
|
private final ConcurrentMap<CleanupKey, CleanupTask> tasks = new ConcurrentHashMap();
|
|
|
|
|
2022-03-08 19:25:03 +00:00
|
|
|
/* loaded from: com.discord-118106.apk:lombok/core/CleanupRegistry$CleanupKey.SCL.lombok */
|
2022-03-01 22:12:19 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|