![JAR search and dependency download from the Maven repository](/logo.png)
net.sf.aguacate.security.service.SecurityServiceCoupling Maven / Gradle / Ivy
package net.sf.aguacate.security.service;
import java.util.Iterator;
import java.util.ServiceLoader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public final class SecurityServiceCoupling {
private static final Logger LOGGER = LogManager.getLogger(SecurityServiceCoupling.class);
private static final SecurityService INSTANCE;
static {
Iterator iterator = ServiceLoader.load(SecurityService.class).iterator();
if (iterator.hasNext()) {
INSTANCE = iterator.next();
while (iterator.hasNext()) {
SecurityService temp = iterator.next();
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("Unused instance of {}", temp.getClass().getName());
}
}
} else {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn("No instance of {} found (NULL instance)", SecurityService.class.getName());
}
INSTANCE = null;
}
}
private SecurityServiceCoupling() {
}
public static SecurityService service() {
return INSTANCE;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy