Hi Andy,
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?
I agree that Query.cancel should be a noop, if query execution hasn't
been started or is already terminated.
Regards Michael
Hi,
Finally got around to running these tests with an implementation of JDOQL that
supports cancellation. I logged the point of calls to Query.cancel,
Query.execute etc.
11:48:59,211 (main) INFO [DataNucleus.General] - >> testCancel : creating
query
11:48:59,240 (main) DEBUG [DataNucleus.Query] - JDOQL Single-String with
"select avg (this.x + point2.y) from PCPoint where this.y >= 0 && point2.x >=
0 variables PCPoint2 point2 import org.apache.jdo.tck.pc.mylib.PCPoint; import
org.apache.jdo.tck.pc.mylib.PCPoint2; "
11:48:59,248 (main) INFO [DataNucleus.General] - >> testCancel : calling
query.cancel() from main thread
11:48:59,248 (Query Executor) DEBUG [DataNucleus.Transaction] - Transaction
created [DataNucleus Transaction, ID=Xid=
, enlisted resources=[]]
11:48:59,248 (main) INFO [DataNucleus.General] - >> Query.cancelThread
thread=21 numTasks=0
11:48:59,249 (Query Executor) DEBUG [DataNucleus.Transaction] - Transaction
begun for ObjectManager org.datanucleus.objectmanageri...@9b6220
(optimistic=false)
11:48:59,249 (Query Executor) INFO [DataNucleus.General] - >> testCancel :
Calling query.execute from thread
11:48:59,249 (Query Executor) DEBUG [DataNucleus.Query] - JDOQL Query :
Compiling "SELECT avg (this.x + point2.y) FROM
org.apache.jdo.tck.pc.mylib.PCPoint WHERE this.y >= 0 && point2.x >= 0
VARIABLES PCPoint2 point2 import org.apache.jdo.tck.pc.mylib.PCPoint;import
org.apache.jdo.tck.pc.mylib.PCPoint2;"
so the conclusion is that the test cancels (or tries to cancel) the query that
it hasn't yet started!
What is the expected behaviour of Query.cancel(Thread) when there are no
queries running in that thread ? noop makes sense to me. That's what
DataNucleus does; the test doesn't cater for that situation.
Suggest that the test needs to allow the query to get to execute() before it
cancels it
Regards
--
*Michael Bouschen*
*Prokurist*
akquinet t...@spree GmbH
Bülowstr. 66, D-10783 Berlin
Fon: +49 30 235 520-33
Fax: +49 30 217 520-12
Email: [email protected]
Url: www.akquinet.de <http://www.akquinet.de>
akquinet t...@spree GmbH, Berlin
Geschäftsführung: Martin Weber, Prof. Dr. Christian Roth
Amtsgericht Berlin-Charlottenburg HRB 86780 B
USt.-Id. Nr.: DE 225 964 680