package com.l7tech.gateway.api.impl;

import com.l7tech.util.ResourceUtils;
import java.io.Closeable;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

public class ResourceTracker implements Closeable {
   private final Set<Closeable> a = new HashSet<>();

   public void registerCloseable(Closeable var1) {
      this.a.add(var1);
   }

   public void unregisterCloseable(Closeable var1) {
      this.a.remove(var1);
   }

   @Override
   public void close() throws IOException {
      for (Closeable var2 : this.a) {
         ResourceUtils.closeQuietly(var2);
      }

      this.a.clear();
   }
}
