Sounds good, thanks


On Tue, May 21, 2013 at 8:53 AM, Brian Stansberry
<notifications@github.com>wrote:

> In
> jpa/core/src/main/java/org/jboss/as/jpa/processor/SecondLevelCache/InfinispanCacheDeploymentListener.java:
>
> > +            serviceName = ServiceName.JBOSS.append(DEFAULT_CACHE_CONTAINER, (name != null) ? name : UUID.randomUUID().toString());
> > +
> > +            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(serviceName, new ValueService<EmbeddedCacheManager>(manager))
> > +                    .addDependency(EmbeddedCacheManagerService.getServiceName(container), EmbeddedCacheManager.class, manager)
> > +                    .setInitialMode(ServiceController.Mode.ACTIVE)
> > +            ;
> > +
> > +            embeddedCacheManager = ServiceContainerHelper.getValue(builder.install());
> > +
> > +        } else {
> > +            // need a shared cache for jpa applications
> > +            serviceName = EmbeddedCacheManagerService.getServiceName(container);
> > +            ServiceRegistry registry = ServiceContainerHelper.getCurrentServiceContainer();
>
> Have a look at what ServiceContainerHelper.getCurrentServiceContainer()
> does. It's a simple utility method that should not be public. The exact
> same code can be added to this class or to a package protected
> SecurityActions class in this package.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/wildfly/wildfly/pull/4486/files#r4315880>
> .
>