Author: jrbauer
Date: Tue Mar 17 04:40:53 2009
New Revision: 755117
URL: http://svn.apache.org/viewvc?rev=755117&view=rev
Log:
OPENJPA-878 Committing code, tests, and documentation updates for Donald Woods.
Added:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/QueryException.java
(with props)
Modified:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreException.java
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/util/localizer.properties
Modified:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java?rev=755117&r1=755116&r2=755117&view=diff
==============================================================================
---
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
(original)
+++
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
Tue Mar 17 04:40:53 2009
@@ -125,6 +125,7 @@
setFetchBatchSize(conf.getFetchBatchSize());
setFlushBeforeQueries(conf.getFlushBeforeQueriesConstant());
setLockTimeout(conf.getLockTimeout());
+ setQueryTimeout(conf.getQueryTimeout());
clearFetchGroups();
addFetchGroups(Arrays.asList(conf.getFetchGroupsList()));
setMaxFetchDepth(conf.getMaxFetchDepth());
Added:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/QueryException.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/QueryException.java?rev=755117&view=auto
==============================================================================
---
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/QueryException.java
(added)
+++
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/QueryException.java
Tue Mar 17 04:40:53 2009
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package org.apache.openjpa.util;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import org.apache.openjpa.lib.util.Localizer;
+
+/**
+ * Exception indicating that a query timeout occurred.
+ *
+ * @since 2.0.0
+ */
+public class QueryException
+ extends StoreException {
+
+ private static final long serialVersionUID = 7375049808087780437L;
+
+ private static final transient Localizer _loc =
Localizer.forPackage(QueryException.class);
+
+ private int timeout = -1;
+
+ public QueryException(Object failed) {
+ super(_loc.get("query-failed"));
+ setFailedObject(failed);
+ }
+
+ public QueryException(Object failed, int timeout) {
+ super(_loc.get("query-timeout", String.valueOf(timeout)));
+ setFailedObject(failed);
+ setTimeout(timeout);
+ }
+
+ public int getSubtype() {
+ return QUERY;
+ }
+
+ /**
+ * The number of milliseconds to wait for a query to complete.
+ */
+ public int getTimeout() {
+ return timeout;
+ }
+
+ /**
+ * The number of milliseconds to wait for a query to complete.
+ */
+ public QueryException setTimeout(int timeout) {
+ this.timeout = timeout;
+ return this;
+ }
+
+ public String toString() {
+ String str = super.toString();
+ if (timeout < 0)
+ return str;
+ return str + Exceptions.SEP + "Query Timeout: " + timeout;
+ }
+
+ private void writeObject(ObjectOutputStream out)
+ throws IOException {
+ out.writeInt(timeout);
+ }
+
+ private void readObject(ObjectInputStream in)
+ throws IOException, ClassNotFoundException {
+ timeout = in.readInt();
+ }
+}
Propchange:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/QueryException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreException.java
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreException.java?rev=755117&r1=755116&r2=755117&view=diff
==============================================================================
---
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreException.java
(original)
+++
openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreException.java
Tue Mar 17 04:40:53 2009
@@ -34,6 +34,7 @@
public static final int OPTIMISTIC = 3;
public static final int REFERENTIAL_INTEGRITY = 4;
public static final int OBJECT_EXISTS = 5;
+ public static final int QUERY = 6;
public StoreException(String msg) {
super(msg);
Modified:
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/util/localizer.properties
URL:
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/util/localizer.properties?rev=755117&r1=755116&r2=755117&view=diff
==============================================================================
---
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/util/localizer.properties
(original)
+++
openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/util/localizer.properties
Tue Mar 17 04:40:53 2009
@@ -73,3 +73,5 @@
no-store-exts: No store-specific facade found matching "{0}". Using default.
objectid-abstract: Cannot create new application identity instance for \
abstract class "{0}".
+query-failed: A query statement timeout has occurred.
+query-timeout: A query statement timeout (set to {0} milliseconds) has
occurred.