org.ehcache.spi
Class ServiceLocator
java.lang.Object
org.ehcache.spi.ServiceLocator
- All Implemented Interfaces:
- ServiceProvider
public final class ServiceLocator
- extends java.lang.Object
- implements ServiceProvider
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ServiceLocator
public ServiceLocator(Service... services)
addService
public void addService(Service service)
getOrCreateServiceFor
public <T extends Service> T getOrCreateServiceFor(ServiceCreationConfiguration<T> config)
getService
public <T extends Service> T getService(java.lang.Class<T> serviceType)
- Description copied from interface:
ServiceProvider
- Will look up the
Service
of the serviceType
.
The returned service will be started or not depending on the started state of the ServiceProvider
.
- Specified by:
getService
in interface ServiceProvider
- Type Parameters:
T
- The actual Service
type- Parameters:
serviceType
- the class
of the service being looked up
- Returns:
- the service instance for
T
type, or null
if it couldn't be located
findAmongst
public static <T> java.util.Collection<T> findAmongst(java.lang.Class<T> clazz,
java.lang.Object... instances)
findSingletonAmongst
public static <T> T findSingletonAmongst(java.lang.Class<T> clazz,
java.lang.Object... instances)
startAllServices
public void startAllServices()
throws java.lang.Exception
- Throws:
java.lang.Exception
stopAllServices
public void stopAllServices()
throws java.lang.Exception
- Throws:
java.lang.Exception
loadDependenciesOf
public void loadDependenciesOf(java.lang.Class<?> clazz)
knowsServiceFor
public boolean knowsServiceFor(ServiceConfiguration serviceConfig)