[hibernate-dev] Timestamper

Alex Snaps alex.snaps at gmail.com
Fri Apr 27 10:46:41 EDT 2012


Right. And I muddied the waters, as I missed these classes were test
code only...
Sorry about this! Shouldn't read code at conferences ;-) Anyways, glad
to see that issue doesn't apply to any production code !

On Fri, Apr 27, 2012 at 10:34 AM, Steve Ebersole <steve at hibernate.org> wrote:
> I guess the confusion was that I never read anywhere that your solution
> involved retrofitting your Timestamper class.  I just read that as you meant
> code should move to use this new SlewClock instead of Timestamper.  The
> hibernate-ehcache integration uses net.sf.ehcache.util.Timestamper, so if
> y'all changed that internally to use your new SlewClock then that usage is
> fine.  The only usage of the org.hibernate.cache.internal.Timestamper class
> (whose internals you contributed) is in the test suite code, aka, no
> production code.  Yes, we should move it to the hibernate-testing package to
> make that completely apparent.
>
>
> On Fri 27 Apr 2012 09:21:26 AM CDT, Alex Snaps wrote:
>>
>> I'm confused... The hibernate-ehcache module was using
>> net.sf.ehcache.util.Timestamper (from 2.4.3) that internally uses the
>> SlewClock ...
>> The hibernate packaged one suffer from the initial issue. Is there
>> plans to change this ?
>>
>> On Fri, Apr 27, 2012 at 10:11 AM, Steve Ebersole<steve at hibernate.org>
>>  wrote:
>>>
>>> Well but we still have the issue of the hibernate-ehcache integration
>>> using
>>> net.sf.ehcache.util.Timestamper.  And we cannot use your SlewClock there
>>> because it is package-protected.
>>>
>>>
>>>
>>> On Fri 27 Apr 2012 09:05:56 AM CDT, Alex Snaps wrote:
>>>>
>>>>
>>>> Right! I see these are all in the hibernate-testing code. I misread
>>>> that sorry! ... and w/o caching, NoCachingRegionFactory is used.
>>>> Well, I guess the fact that it might loop for "longer" would be less
>>>> of an issue then. I'd maybe just evaluate moving that class into the
>>>> hibernate-testing as well maybe, avoiding someone actually uses for
>>>> "production" code.
>>>>
>>>> On Fri, Apr 27, 2012 at 9:52 AM, Steve Ebersole<steve at hibernate.org>
>>>>  wrote:
>>>>>
>>>>>
>>>>> No, that is not how we "timestamp every Session".
>>>>>
>>>>> Ok, its there but...
>>>>>
>>>>> final class SlewClock  {...
>>>>>
>>>>> package-protected
>>>>>
>>>>>
>>>>>
>>>>> On Fri 27 Apr 2012 08:49:07 AM CDT, Alex Snaps wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> Steve,
>>>>>> I do see it in the repo on the 2.4.3 tagline :
>>>>>>
>>>>>>
>>>>>>
>>>>>> http://svn.terracotta.org/svn/ehcache/tags/ehcache-core-2.4.3/src/main/java/net/sf/ehcache/util/SlewClock.java
>>>>>> Also, correct me if I'm wrong, but I think the Timestamper code is
>>>>>> used to timestamp every Session, isn't it ? If so, it does impact more
>>>>>> than just hibernate-ehcache...
>>>>>> I can wire it in and do a pull request. I just wasn't sure that's what
>>>>>> you guys wanted ?
>>>>>> Alex
>>>>>>
>>>>>> On Fri, Apr 27, 2012 at 9:40 AM, Steve Ebersole<steve at hibernate.org>
>>>>>>  wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Well, to be specific I am not seeing it in 2.4.3 version of
>>>>>>> ehcache-core
>>>>>>> jar
>>>>>>> (which is jar where Timestamper was found)...
>>>>>>>
>>>>>>>
>>>>>>> On Fri 27 Apr 2012 08:37:53 AM CDT, Steve Ebersole wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Alex, the issue you mentioned says it was fixed for 2.4.3, but I am
>>>>>>>> not seeing SlewClock in 2.4.3 jar.
>>>>>>>>
>>>>>>>> What version was SlewClock added in?
>>>>>>>>
>>>>>>>> On Fri 27 Apr 2012 08:36:33 AM CDT, Steve Ebersole wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Alex, the issue you mentioned says it was fixed for 2.4.3, but I am
>>>>>>>>> not seeing SlewClock in 2.4.3 jar.
>>>>>>>>>
>>>>>>>>> What version was SlewClock added in?
>>>>>>>>>
>>>>>>>>> On Thu 26 Apr 2012 12:48:31 PM CDT, Steve Ebersole wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Thanks for the heads up Alex.
>>>>>>>>>>
>>>>>>>>>> https://hibernate.onjira.com/browse/HHH-7282
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Thu 26 Apr 2012 11:11:36 AM CDT, Alex Snaps wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Hey,
>>>>>>>>>>> I wanted to draw your attention to "an issue" we've hit with the
>>>>>>>>>>> nonblocking implementation of Timestamper, that you guys use as
>>>>>>>>>>> well.
>>>>>>>>>>> Basically, if time goes backwards, calling next() would loop
>>>>>>>>>>> until
>>>>>>>>>>> time is passed the last seen value (see
>>>>>>>>>>> http://jira.terracotta.org/jira/browse/EHC-853)
>>>>>>>>>>> Technically, time shouldn't go back. Especially the DST issue is
>>>>>>>>>>> none
>>>>>>>>>>> in my opinion. But NTP daemons that do set clock back might be
>>>>>>>>>>> more
>>>>>>>>>>> common.
>>>>>>>>>>> As every session is timestamped, if I read
>>>>>>>>>>> SessionFactoryImpl.SessionBuilderImpl.openSession correctly, this
>>>>>>>>>>> would be larger issue to you guys now as well. There are
>>>>>>>>>>> obviously
>>>>>>>>>>> more people using Hibernate w/o Ehcache than with it.
>>>>>>>>>>> Anyways, as a solution to that, Chris and I came up with a
>>>>>>>>>>> non-blocking SlewClock implementation that would simply, in case
>>>>>>>>>>> System.currentTimeMillis() returns a value "in the past, slow
>>>>>>>>>>> time
>>>>>>>>>>> down until the wall clock has caught up:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> http://www.massapi.com/source/ehcache-2.4.3/src/net/sf/ehcache/util/SlewClock.java.html
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Since Timestamper is again core to 2nd level cache usage in
>>>>>>>>>>> Hibernate,
>>>>>>>>>>> it would make sense to this out of our code base and have it in
>>>>>>>>>>> yours
>>>>>>>>>>> (as well, as we'd still use it in for the 3.x).
>>>>>>>>>>> Should I go ahead and create a jira, pull request, ... ? Cause,
>>>>>>>>>>> based
>>>>>>>>>>> on my experience, blaming it on crappy env. hasn't really worked
>>>>>>>>>>> out
>>>>>>>>>>> for me ;-)
>>>>>>>>>>> Alex
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> steve at hibernate.org
>>>>>>>>>> http://hibernate.org
>>>>>>>>>> --
>>>>>>>>>> steve at hibernate.org
>>>>>>>>>> http://hibernate.org
>>>>>>>>>> --
>>>>>>>>>> steve at hibernate.org
>>>>>>>>>> http://hibernate.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> steve at hibernate.org
>>>>> http://hibernate.org
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> steve at hibernate.org
>>> http://hibernate.org
>>
>>
>>
>>
>
> --
> 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



More information about the hibernate-dev mailing list