org.jboss.resteasy.reactive.spi.BeanFactory Maven / Gradle / Ivy
package org.jboss.resteasy.reactive.spi;
import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
public interface BeanFactory {
/**
* Creates an endpoint instance outside the scope of a request
*/
BeanInstance createInstance();
interface BeanInstance extends AutoCloseable {
T getInstance();
void close();
class ClosingTask implements Closeable {
private final Collection> instances;
public ClosingTask(Collection> instances) {
this.instances = instances;
}
@Override
public void close() throws IOException {
for (BeanFactory.BeanInstance i : instances) {
i.close();
}
}
}
}
}