db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Jefferson <a...@datanucleus.org>
Subject Re: TCK tests : QueryCancel
Date Sat, 13 Mar 2010 11:29:05 GMT
Hi Michael,

> I added a Thread.sleep(1000) to the main thread in order to give the
> other thread a chance to start the query before the main thread cancels
> it. Could you please give it a try?

Giving something a second to get started seems excessive, I know Derby is slow 
but ... ;-) 
I tried with a value more like 80 or 100 (millis) and managed **on occasions** 
to get a JDOQueryInterruptedException (and pass the test). Other times the 
cancel still got in first. I also added a query.compile() before starting the 
threads hence less for the query execute to do before starting, but still 
intermittent. The intermittency will also be affected by the machine being 
used, hence the number is arbitrary. The query execution time (in the 
datastore) is anywhere between 60ms and 2ms on my machine.

Depends what the cancel is allowing cancel over; to be consistent with the 
timeout I assume it is cancel the datastore operation (as opposed to the whole 
query execute process ... compile, generate PreparedStatement, populate 
parameter values, execute in the datastore, return results), and so 
DataNucleus only starts the execution in a separate thread and maintains the 
handle on that thread for cancellation purposes. If this execution thread is 
either not yet created, or is now finished then the test will fail, always.

Shouldn't the test also take into account if the query does actually return 
the results before the cancel can be called ?

DataNucleus (http://www.datanucleus.org)

View raw message