protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
// Find a suitable service name to represent this session factory instance
String name = properties.getProperty(AvailableSettings.SESSION_FACTORY_NAME);
this.serviceName = ServiceName.JBOSS.append(DEFAULT_CACHE_CONTAINER, (name != null) ? name : UUID.randomUUID().toString());
String container = properties.getProperty(CACHE_CONTAINER, DEFAULT_CACHE_CONTAINER);
ServiceContainer target = ServiceContainerHelper.getCurrentServiceContainer();
// Create a mock service that represents this session factory instance
InjectedValue<EmbeddedCacheManager> manager = new InjectedValue<EmbeddedCacheManager>();
ServiceBuilder<EmbeddedCacheManager> builder = target.addService(this.serviceName, new ValueService<EmbeddedCacheManager>(manager))
.addDependency(EmbeddedCacheManagerService.getServiceName(container), EmbeddedCacheManager.class, manager)
.setInitialMode(ServiceController.Mode.ACTIVE)
;
HibernateSecondLevelCache.addSecondLevelCacheDependencies(target, target, builder, new HibernateMetaData(properties));
try {