with some more latches cancel() can be 'sync' to be deterministic and
not depending on time I think, isn't it?


Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-06-04 15:44 GMT+02:00 Andy Gumbrecht <agumbre...@tomitribe.com>:
> Sure, we agree.
>
> I am looking at the tests now and will commit something better soon.
> The test is also testing the ability to cancel the scheduled task, so it is
> not really important that the 'count' is accurate.
> It does however have to test over an arbitrary period of time.
>
> Andy.
>
> On 04/06/2014 14:31, hanas...@gmail.com wrote:
>>
>> *From:* Romain Manni-Bucau <rmannibu...@gmail.com>
>> *Sent:*  Wednesday, June 04, 2014 6:48AM
>> *To:* dev@tomee.apache.org <dev@tomee.apache.org>
>> *Subject:* Re: Fwd: svn commit: r1600089 -
>> /tomee/tomee/trunk/container/openejb-concurrency-utilities-ee/src/test/java/org/apache/openejb/concurrencyutilities/test/ManagedScheduledExecutorServiceTest.java
>>
>> Is this based on my posting yesterday about a build failure that
>> subsequently passed when increasing the sleep time?
>>
>> Either way, the thread waits are a bit indeterminate and could lead to
>> longer build times and unrepeatable success / failure builds based on the
>> size of hardware or load at the time of build.
>>
>> On 06/04/2014 06:48 AM, Romain Manni-Bucau wrote:
>>>
>>> Hehe no hurry ;).
>>>
>>>
>>> Romain Manni-Bucau
>>> Twitter: @rmannibucau
>>> Blog: http://rmannibucau.wordpress.com/
>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>> Github: https://github.com/rmannibucau
>>>
>>>
>>> 2014-06-04 13:44 GMT+02:00 Andy Gumbrecht <agumbre...@tomitribe.com>:
>>>>
>>>> Sure, sounds good to me - I'll have another look in a minute, just got
>>>> to
>>>> get a sandwich for lunch :-D
>>>>
>>>> Andy.
>>>>
>>>>
>>>> On 04/06/2014 13:39, Romain Manni-Bucau wrote:
>>>>>
>>>>>
>>>>> I'd go for a version with latches and no sleep rather.
>>>>>
>>>>>
>>>>> Romain Manni-Bucau
>>>>> Twitter: @rmannibucau
>>>>> Blog: http://rmannibucau.wordpress.com/
>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>>> Github: https://github.com/rmannibucau
>>>>>
>>>>>
>>>>> 2014-06-04 13:28 GMT+02:00 Andy Gumbrecht <agumbre...@tomitribe.com>:
>>>>>>
>>>>>>
>>>>>> I saw that also, and decided to leave it - I.e. not change it.
>>>>>>
>>>>>> It looks like it's there because the test could potentially return 7
>>>>>> due
>>>>>> to
>>>>>> getNextRunTime and Thread.sleep(5000) not really guaranteeing count
>>>>>> accuracy
>>>>>> .
>>>>>>
>>>>>> Maybe just testing for > 5 is better.
>>>>>>
>>>>>> Andy.
>>>>>>
>>>>>>
>>>>>> On 04/06/2014 13:06, Romain Manni-Bucau wrote:
>>>>>>>
>>>>>>>
>>>>>>> any reason to tolerate 1 of delta?
>>>>>>>
>>>>>>>
>>>>>>> Romain Manni-Bucau
>>>>>>> Twitter: @rmannibucau
>>>>>>> Blog: http://rmannibucau.wordpress.com/
>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>>>>>>> Github: https://github.com/rmannibucau
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------- Forwarded message ----------
>>>>>>> From:  <andygumbre...@apache.org>
>>>>>>> Date: 2014-06-04 12:26 GMT+02:00
>>>>>>> Subject: svn commit: r1600089 -
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> /tomee/tomee/trunk/container/openejb-concurrency-utilities-ee/src/test/java/org/apache/openejb/concurrencyutilities/test/ManagedScheduledExecutorServiceTest.java
>>>>>>> To: comm...@tomee.apache.org
>>>>>>>
>>>>>>>
>>>>>>> Author: andygumbrecht
>>>>>>> Date: Wed Jun  4 10:26:12 2014
>>>>>>> New Revision: 1600089
>>>>>>>
>>>>>>> URL: http://svn.apache.org/r1600089
>>>>>>> Log:
>>>>>>> Use a blocking method
>>>>>>>
>>>>>>> Modified:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> tomee/tomee/trunk/container/openejb-concurrency-utilities-ee/src/test/java/org/apache/openejb/concurrencyutilities/test/ManagedScheduledExecutorServiceTest.java
>>>>>>>
>>>>>>> Modified:
>>>>>>>
>>>>>>>
>>>>>>> tomee/tomee/trunk/container/openejb-concurrency-utilities-ee/src/test/java/org/apache/openejb/concurrencyutilities/test/ManagedScheduledExecutorServiceTest.java
>>>>>>> URL:
>>>>>>>
>>>>>>>
>>>>>>> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-concurrency-utilities-ee/src/test/java/org/apache/openejb/concurrencyutilities/test/ManagedScheduledExecutorServiceTest.java?rev=1600089&r1=1600088&r2=1600089&view=diff
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ==============================================================================
>>>>>>> ---
>>>>>>>
>>>>>>>
>>>>>>> tomee/tomee/trunk/container/openejb-concurrency-utilities-ee/src/test/java/org/apache/openejb/concurrencyutilities/test/ManagedScheduledExecutorServiceTest.java
>>>>>>> (original)
>>>>>>> +++
>>>>>>>
>>>>>>>
>>>>>>> tomee/tomee/trunk/container/openejb-concurrency-utilities-ee/src/test/java/org/apache/openejb/concurrencyutilities/test/ManagedScheduledExecutorServiceTest.java
>>>>>>> Wed Jun  4 10:26:12 2014
>>>>>>> @@ -81,7 +81,7 @@ public class ManagedScheduledExecutorSer
>>>>>>>             assertEquals(6, future.get().intValue());
>>>>>>>
>>>>>>>             future.cancel(true);
>>>>>>> -        assertEquals(6, counter.get(), 1);
>>>>>>> +        assertEquals(6, counter.getAndIncrement(), 1);
>>>>>>>
>>>>>>>             Thread.sleep(2000); // since get() is not blocking, wait
>>>>>>> a
>>>>>>> bit the task ends up
>>>>>>>
>>>>>>> @@ -118,7 +118,7 @@ public class ManagedScheduledExecutorSer
>>>>>>>             Thread.sleep(5000);
>>>>>>>
>>>>>>>             future.cancel(true);
>>>>>>> -        assertEquals(6, counter.get(), 1);
>>>>>>> +        assertEquals(6, counter.getAndIncrement(), 1);
>>>>>>>
>>>>>>>             Thread.sleep(2000); // since get() is not blocking, wait
>>>>>>> a
>>>>>>> bit the task ends
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>>     Andy Gumbrecht
>>>>>>
>>>>>>     http://www.tomitribe.com
>>>>>>     agumbre...@tomitribe.com
>>>>>>     https://twitter.com/AndyGeeDe
>>>>>>
>>>>>>     TomEE treibt Tomitribe! | http://tomee.apache.org
>>>>>>
>>>>>
>>>>
>>>> --
>>>>    Andy Gumbrecht
>>>>
>>>>    http://www.tomitribe.com
>>>>    agumbre...@tomitribe.com
>>>>    https://twitter.com/AndyGeeDe
>>>>
>>>>    TomEE treibt Tomitribe! | http://tomee.apache.org
>>>>
>>
>>
>
> --
>   Andy Gumbrecht
>
>   http://www.tomitribe.com
>   agumbre...@tomitribe.com
>   https://twitter.com/AndyGeeDe
>
>   TomEE treibt Tomitribe! | http://tomee.apache.org
>

Reply via email to