[hibernate-dev] Ehcache integration

Strong Liu stliu at hibernate.org
Thu Jul 14 05:13:39 EDT 2011


okay, so the problem is you need ServiceRegistry in your ehcache RegionFactory impl, right?

you can do it this way:

class EhcacheRegionFactory implements RegionFacotry{
	private ClassLoaderService classLoaderService;

	@InjectService
	public void setClassLoaderService(ClassLoaderService classLoaderService) {
		this.classLoaderService = classLoaderService;
	}
.....
}

then the ClassLoaderService will be injected automaticly 

-----------
Strong Liu <stliu at hibernate.org>
http://hibernate.org
http://github.com/stliu

On Jul 14, 2011, at 5:05 PM, Alex Snaps wrote:

> Strong,
> I did fix that that way now indeed (moved the static method to
> RegionFactoryInitiator and made it public for now, given the hack
> still in place). I'll look into having the EhcacheIntegratorService
> loaded none the less and so I get the ClassLoaderService available in
> the EhcacheRegionFactories.
> Thanks!
> 
> On Thu, Jul 14, 2011 at 11:00 AM, Strong Liu <stliu at hibernate.org> wrote:
>> Alex
>> 
>> (i already commented in your pull request)
>> 
>> cache provider is integrated by org.hibernate.cache.internal.RegionFactoryInitiator, and the mapLegency should go into this class too.
>> it is in process of moving from SettingsFactory.createRegionFactory to RegionFactoryInitiator
>> 
>> -----------
>> Strong Liu <stliu at hibernate.org>
>> http://hibernate.org
>> http://github.com/stliu
>> 
>> On Jul 14, 2011, at 4:57 PM, Alex Snaps wrote:
>> 
>>> Yeah.
>>> I wanted to have an EhcacheIntegratorService registered, that would,
>>> during the integrate call, do the potential mapping from old to new
>>> name (so this would be able to use ....class.getName()).
>>> Also, I could keep a ref to the ServiceRegistry, so I'd be able to
>>> address any classloader concerns you mentioned.
>>> Not sure what that would give wrt to the hack on getting the
>>> RegionFactory in org.hibernate.cfg.SettingsFactory.createRegionFactory
>>> But anyways, I don't really see how to plug that integrator in... So
>>> that seems like the wrong path.
>>> 
>>> On Thu, Jul 14, 2011 at 3:18 AM, Strong Liu <stliu at hibernate.org> wrote:
>>>> 
>>>> 
>>>> On Jul 14, 2011, at 4:57 AM, Steve Ebersole wrote:
>>>> 
>>>>> Or do you mean java.util.ServiceLoader ?
>>>> 
>>>> yes, i think Alex means this
>>>>> 
>>>>> On Wed 13 Jul 2011 03:54:16 PM CDT, Steve Ebersole wrote:
>>>>>> On 07/13/2011 09:46 AM, Strong Liu wrote:
>>>>>>> On Jul 11, 2011, at 10:48 PM, Alex Snaps wrote:
>>>>>>> 
>>>>>>> a warning
>>>>>>>> - Second level cache isn't (yet?) using "ServiceInitiator approach",
>>>>>>>> is this going to change ?
>>>>>>> 
>>>>>>> I don't pre-see it, Steve?
>>>>>>>> - Right now the mapping plan is "weak" in terms of typing since core
>>>>>>>> doesn't know anything about hibernate-ehcache. I guess, if second
>>>>>>>> level caching also goes the ServiceInitiator path, that will change,
>>>>>>>> right ?
>>>>>> org.hibernate.cache.internal.RegionFactoryInitiator
>>>>> 
>>>>> --
>>>>> steve at hibernate.org
>>>>> http://hibernate.org
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Alex Snaps <alex.snaps at gmail.com>
>>> Senior Software Engineer - Terracotta
>>> http://twitter.com/alexsnaps
>>> http://www.linkedin.com/in/alexsnaps
>> 
>> 
> 
> 
> 
> -- 
> Alex Snaps <alex.snaps at gmail.com>
> Senior Software Engineer - Terracotta
> http://twitter.com/alexsnaps
> http://www.linkedin.com/in/alexsnaps





More information about the hibernate-dev mailing list