[hibernate-dev] lookup of Infinispan cachemanager for Search's own dirty reasons

Galder Zamarreño galder at jboss.org
Thu Nov 18 03:20:37 EST 2010

On Nov 17, 2010, at 4:31 PM, Sanne Grinovero wrote:

> Hello,
> thanks all for the clarifications; I was wrongly assuming that we
> should have just one CacheManager running in AS6.
> Now I see, I'll use my own independent one.
> I'm making sure Hibernate Search is able to start (and stop) it's own
> CacheManager, or instead retrieve one via JNDI.

Just make sure you don't stop it if bound to JNDI! :)

> So now I don't see anymore a strong reason to define a default name,
> nor bundle a configuration into JBoss6 - agree?

It's not so easy to make that decision. You should check with the AS6 guys to see what they'd need. Best persons to contact are Paul Ferraro and Scott Marlow.

But to give you an idea, this is what happens with 2LC, which you might wanna follow:

The Infinispan 2LC does ship a configuration for standalone usage. But when running within AS, it's often the case that AS might wanna centrally manage some things, such as the JGroups transport level.

So, what AS take the the 2LC config and put it within a file called infinispan-configs.xml that allows it to centrally manage it. See http://anonsvn.jboss.org/repos/jbossas/trunk/cluster/src/resources/infinispan/infinispan-configs.xml

> So it will first try to find a CacheManager via JNDI using the name
> defined with the following configuration property:
> "hibernate.search.infinispan.cachemanager_jndiname"
> (underscore is a convention used in many other Search's properties)
> If this property is undefined, it will look for this one:
> hibernate.search.infinispan.configuration_resourcename
> which should point to an Infinispan configuration file.
> If this is not defined either, we fall back to the resourcename
> "default-hibernatesearch-infinispan.xml"
> which will be included in Hibernate Search, providing general purpose
> defaults but no cachestore.
> Cheers,
> Sanne
> 2010/11/17 Galder Zamarreño <galder at jboss.org>:
>> On Nov 16, 2010, at 6:25 PM, Sanne Grinovero wrote:
>>> Hi,
>>> I see that the Infinispan second level cache defines a nice property
>>> "hibernate.cache.infinispan.cachemanager" to search an existing
>>> CacheManager via JNDI.
>>> Now in case of Hibernate Search's DirectoryProvider making use of
>>> Infinispan, I suppose that people will want to lookup the same
>>> CacheManager,
>>> which then would be used for both purposes, even if very likely the
>>> configuration will contain different caches for each use case.
>> Hmmm, not so sure about that actually.
>> Your cache manager and the 2LC one have different purposes and can you guarantee that your app won't end up using a 2LC cache by mistake? You'd need to have some kind of knowledge of the cache naming there.
>> So, -1 to this.
>>> So from Hibernate Search's new module, shall I look for the same
>>> property? The "cache" part in the name is unfortunate, still I would
>>> like to define it just once.
>>> Ideas>
>>> 1 - add a new property "hibernate.infinispan.jndiname", and have the
>>> 2LC look for this as fallback, I'll look for the same
>> No, you need your own property. Why not start naming it with hibernate.search.X and that way you avoid collisions with other hibernate properties?
>>> 2 - I suppose JBoss6 will bind it to JNDI by default, could we use
>>> this name as default in Hibernate to bring configuration need to the
>>> minimum?
>> JBoss6 uses different cache managers, not just one: i.e. WebSessions, 2LC, EJb3SFSB, so I doubt there's a single JNDI name there.
>>> In that case I'd love to add some cache configurations for the dirty
>>> purposes of Hibernate Search in the AS distribution, so that stuff
>>> works with minimal configuration hazards.
>>> Cheers,
>>> Sanne
>>> _______________________________________________
>>> hibernate-dev mailing list
>>> hibernate-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>> --
>> Galder Zamarreño
>> Sr. Software Engineer
>> Infinispan, JBoss Cache

Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache

More information about the hibernate-dev mailing list