Hi Andy,
Sounds like some more sophisticated thread synchronization is needed
in the test cases.
Craig
On Mar 11, 2010, at 3:53 AM, Andy Jefferson wrote:
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
--
Andy
DataNucleus (http://www.datanucleus.org)
Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!