db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew T. Adams (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JDO-623) Query cancel and timeout support
Date Fri, 17 Apr 2009 17:52:14 GMT

    [ https://issues.apache.org/jira/browse/JDO-623?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700257#action_12700257
] 

Matthew T. Adams commented on JDO-623:
--------------------------------------

I think we need an overloaded method here, cancel(Thread), and possible an additional method,
cancelAll().

In the event that a user shares a single Query instance across multiple threads, each of which
is calling execute() in parallel, there is no way for the thread calling cancel to communicate
to the implementation exactly which thread's running query to cancel.  This implies that there
needs to be an overload that takes a Thread instance:  cancel(Thread).

This has implications on Query#execute():  the implementation must note which Thread a query
execution is executing on.  This would allow the user to call cancel() in the simple, more
common use case of only one query execution thread, as there would be only one execution recorded,
and it would be the one to be cancelled.  However, in the more complicated use case of multiple,
concurrent executions, cancel() could either cancel all current executions, or throw a JDOUserException
indicating an ambiguous cancellation request.  If we decide that the method should throw,
then another convenient method would be cancelAll().

> Query cancel and timeout support
> --------------------------------
>
>                 Key: JDO-623
>                 URL: https://issues.apache.org/jira/browse/JDO-623
>             Project: JDO
>          Issue Type: New Feature
>          Components: api2, tck2
>            Reporter: Andy Jefferson
>            Assignee: Andy Jefferson
>             Fix For: JDO 2 maintenance release 3
>
>         Attachments: JDO-623-mbo.patch, query_timeout.patch
>
>
> JDO doesn't have a mechanism to stop queries from overrunning. JPA2 now allows 
> a persistence property to allow timing them out, and most JDO implementations 
> have allowed this as an extension since JDO1. It would make sense for JDO 
> (2.3) to have the same or a variation. I propose having the following
> Simple PMF property "javax.jdo.option.queryTimeout" to specify the number of millisecs
(or secs) before any query is timed out. Throw a QueryTimeoutException (extends JDOException)
when the timeout happens.
> Add methods Query.setTimeout(int), Query.getTimeout() to allow setting/retrieving the
timeout interval on a per-query basis.
> Add method Query.cancel() to cancel any running query. If an implementation doesn't support
cancelling of queries then it should throw a JDOUnsupportedOptionException. Any query execute()
that is cancelled will throw a QueryInterruptedException (extends JDOUserException).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message