Return-Path: Delivered-To: apmail-openjpa-commits-archive@www.apache.org Received: (qmail 64824 invoked from network); 17 Mar 2009 04:41:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Mar 2009 04:41:15 -0000 Received: (qmail 15786 invoked by uid 500); 17 Mar 2009 04:41:15 -0000 Delivered-To: apmail-openjpa-commits-archive@openjpa.apache.org Received: (qmail 15772 invoked by uid 500); 17 Mar 2009 04:41:15 -0000 Mailing-List: contact commits-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list commits@openjpa.apache.org Received: (qmail 15763 invoked by uid 99); 17 Mar 2009 04:41:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Mar 2009 21:41:15 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Mar 2009 04:41:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id F2DA22388975; Tue, 17 Mar 2009 04:40:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r755117 - in /openjpa/trunk/openjpa-kernel/src/main: java/org/apache/openjpa/kernel/ java/org/apache/openjpa/util/ resources/org/apache/openjpa/util/ Date: Tue, 17 Mar 2009 04:40:53 -0000 To: commits@openjpa.apache.org From: jrbauer@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090317044053.F2DA22388975@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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.