[hibernate-dev] Ehcache integration

Alex Snaps alex.snaps at gmail.com
Thu Jul 14 06:52:41 EDT 2011


Right, which would work once the ServiceRegistry will be used. Just
did a couple of test with changing the RegionFactory Lookup code and
it seems like it's all working fine. So that is injected, it'll use
ClassLoaderService.locateResource now. Still have to look into why it
didn't work when the method was declared on the Abstract class
though... Given the quick look I had, it should have had. Anyways...
Also tried the Integrator approach to map legacy names in the prop and
replace it there, but it looks like this happens after the
RegionFactory has been instantiated already. So I'll leave the mapping
code in the RegionFactoryInitiator.
I'll delete that code and cleanup and will do another pull request later today.
Thanks a lot for you help Strong!

On Thu, Jul 14, 2011 at 11:13 AM, Strong Liu <stliu at hibernate.org> wrote:
> 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
>
>



-- 
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