You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by an...@apache.org on 2009/02/12 20:16:51 UTC
svn commit: r743843 - in /db/jdo/trunk/api2/src/java/javax/jdo:
JDOHelper.java JDOQueryInterruptedException.java
JDOQueryTimeoutException.java PersistenceManagerFactory.java Query.java
Author: andyj
Date: Thu Feb 12 19:16:51 2009
New Revision: 743843
URL: http://svn.apache.org/viewvc?rev=743843&view=rev
Log:
JDO-623 Apply changes posted on JIRA, but with Craig changes about namings of methods including "Millis"
Added:
db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryInterruptedException.java
db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryTimeoutException.java
Modified:
db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java
db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java
db/jdo/trunk/api2/src/java/javax/jdo/Query.java
Modified: db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java?rev=743843&r1=743842&r2=743843&view=diff
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/JDOHelper.java Thu Feb 12 19:16:51 2009
@@ -162,6 +162,9 @@
xref.put(
PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID,
PROPERTY_SERVER_TIME_ZONE_ID);
+ xref.put(
+ PMF_ATTRIBUTE_QUERY_TIMEOUT,
+ PROPERTY_QUERY_TIMEOUT);
return Collections.unmodifiableMap(xref);
}
@@ -1699,7 +1702,6 @@
throw new JDOFatalUserException (msg.msg (
"EXC_GetPMFNullFile")); //NOI18N
- Properties props = new Properties();
InputStream in = null;
try {
in = new FileInputStream(propsFile);
Added: db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryInterruptedException.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryInterruptedException.java?rev=743843&view=auto
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryInterruptedException.java (added)
+++ db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryInterruptedException.java Thu Feb 12 19:16:51 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * JDOUnsupportedOptionException.java
+ *
+ */
+package javax.jdo;
+
+/**
+ * This class represents exceptions caused when a query is cancelled by a user calling
+ * Query.cancel().
+ *
+ * @since 2.3
+ */
+public class JDOQueryInterruptedException extends JDOUserException {
+ /**
+ * Constructs a new <code>JDOQueryInterruptedException</code> without a detail message.
+ */
+ public JDOQueryInterruptedException() {
+ }
+
+ /**
+ * Constructs a new <code>JDOQueryInterruptedException</code> with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOQueryInterruptedException(String msg) {
+ super(msg);
+ }
+}
Added: db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryTimeoutException.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryTimeoutException.java?rev=743843&view=auto
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryTimeoutException.java (added)
+++ db/jdo/trunk/api2/src/java/javax/jdo/JDOQueryTimeoutException.java Thu Feb 12 19:16:51 2009
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * JDOUnsupportedOptionException.java
+ *
+ */
+package javax.jdo;
+
+/**
+ * This class represents exceptions caused when a query reaches a specified timeout
+ * without completing.
+ * @since 2.3
+ */
+public class JDOQueryTimeoutException extends JDOUserException {
+ /**
+ * Constructs a new <code>JDOQueryTimeoutException</code> without a detail message.
+ */
+ public JDOQueryTimeoutException() {
+ }
+
+ /**
+ * Constructs a new <code>JDOQueryTimeoutException</code> with the specified detail message.
+ * @param msg the detail message.
+ */
+ public JDOQueryTimeoutException(String msg) {
+ super(msg);
+ }
+}
Modified: db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java?rev=743843&r1=743842&r2=743843&view=diff
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/PersistenceManagerFactory.java Thu Feb 12 19:16:51 2009
@@ -520,6 +520,22 @@
*/
void setTransactionIsolationLevel(String level);
+ /** Set the default query timeout setting for all <code>PersistenceManager</code>
+ * instances obtained from this factory.
+ *
+ * @param interval The default timeout setting (millisecs).
+ * @since 2.3
+ */
+ void setQueryTimeoutMillis(int interval);
+
+ /** Get the default query timeout setting for all
+ * <code>PersistenceManager</code> instances obtained from this factory.
+ *
+ * @return the default query timeout setting.
+ * @since 2.3
+ */
+ int getQueryTimeoutMillis();
+
/** Return non-configurable properties of this
* <code>PersistenceManagerFactory</code>.
* Properties with keys <code>VendorName</code> and
Modified: db/jdo/trunk/api2/src/java/javax/jdo/Query.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/src/java/javax/jdo/Query.java?rev=743843&r1=743842&r2=743843&view=diff
==============================================================================
--- db/jdo/trunk/api2/src/java/javax/jdo/Query.java (original)
+++ db/jdo/trunk/api2/src/java/javax/jdo/Query.java Thu Feb 12 19:16:51 2009
@@ -269,12 +269,16 @@
void compile();
/** Execute the query and return the filtered Collection.
+ * <P>Cancellation of the query using cancel() will result in JDOQueryInterruptedException
+ * being thrown here
* @return the filtered <code>Collection</code>.
* @see #executeWithArray(Object[] parameters)
*/
Object execute();
/** Execute the query and return the filtered <code>Collection</code>.
+ * <P>Cancellation of the query using cancel() will result in JDOQueryInterruptedException
+ * being thrown here
* @return the filtered <code>Collection</code>.
* @see #executeWithArray(Object[] parameters)
* @param p1 the value of the first parameter declared.
@@ -282,6 +286,8 @@
Object execute(Object p1);
/** Execute the query and return the filtered <code>Collection</code>.
+ * <P>Cancellation of the query using cancel() will result in JDOQueryInterruptedException
+ * being thrown here
* @return the filtered <code>Collection</code>.
* @see #executeWithArray(Object[] parameters)
* @param p1 the value of the first parameter declared.
@@ -290,6 +296,8 @@
Object execute(Object p1, Object p2);
/** Execute the query and return the filtered <code>Collection</code>.
+ * <P>Cancellation of the query using cancel() will result in JDOQueryInterruptedException
+ * being thrown here
* @return the filtered <code>Collection</code>.
* @see #executeWithArray(Object[] parameters)
* @param p1 the value of the first parameter declared.
@@ -305,6 +313,8 @@
* is the value used in the <code>execute</code> method. The keys in the
* <code>Map</code> and the declared parameters must exactly match or a
* <code>JDOUserException</code> is thrown.
+ * <P>Cancellation of the query using cancel() will result in JDOQueryInterruptedException
+ * being thrown here
* @return the filtered <code>Collection</code>.
* @see #executeWithArray(Object[] parameters)
* @param parameters the <code>Map</code> containing all of the parameters.
@@ -328,6 +338,8 @@
* query. It is then evaluated by the Boolean expression of the filter.
* The element passes the filter if there exist unique values for all
* variables for which the filter expression evaluates to <code>true</code>.
+ * <P>Cancellation of the query using cancel() will result in JDOQueryInterruptedException
+ * being thrown here
* @return the filtered <code>Collection</code>.
* @param parameters the <code>Object</code> array with all of the
* parameters.
@@ -685,4 +697,19 @@
(Query sub, String variableDeclaration,
String candidateCollectionExpression, Map parameters);
+ /**
+ * Specify a timeout interval (milliseconds) for any query executions.
+ * If a query hasn't completed within this interval execute() will throw a
+ * JDOQueryTimeoutException.
+ * @since 2.3
+ * @param interval The timeout interval (millisecs)
+ */
+ void setTimeoutMillis(int interval);
+
+ /**
+ * Method to cancel any executing queries.
+ * If the underlying datastore doesn't support cancellation of queries this will
+ * throw JDOUnsupportedOptionException.
+ */
+ void cancel();
}