KieService ks = KieServices.Factory.get();
package org.kie.api;
import org.kie.api.internal.utils.ServiceRegistry;
/**
* <p>
* The KieServices is a thread-safe singleton acting as a hub giving access to the other
* Services provided by Kie. As general rule a getX() method just returns a reference to another
* singleton while a newX() one creates a new instance.
* </p>
* <p>
* It is possible to obtain a KieServices reference via its Factory as it follows
* </p>
* <pre>
* KieServices kieServices = KieServices.Factory.get();
* </pre>
*/
public interface KieServices {
/**
* Returns a reference to the KieServices singleton
*/
static KieServices get() {
return Factory.get();
}
/**
* A Factory for this KieServices
*/
class Factory {
private static class LazyHolder {
private static KieServices INSTANCE = ServiceRegistry.getInstance().get(KieServices.class);
}
/**
* Returns a reference to the KieServices singleton
*/
public static KieServices get() {
return LazyHolder.INSTANCE;
}
}
}