openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r835190 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/
Date Thu, 12 Nov 2009 02:04:22 GMT
Author: allee8285
Date: Thu Nov 12 02:04:12 2009
New Revision: 835190

URL: http://svn.apache.org/viewvc?rev=835190&view=rev
Log:
OPENJPA-1142 - Propagate lock level into LockException so that the proper optimistic/pessimistic
exception is translated.

Added:
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java
  (with props)
Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLExceptions.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java?rev=835190&r1=835189&r2=835190&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/GenericResultObjectProvider.java
Thu Nov 12 02:04:12 2009
@@ -49,7 +49,7 @@
      * @param fetch the fetch configuration, or null for default
      * @param res the result containing the data
      */
-    public GenericResultObjectProvider(Class pcClass,
+    public GenericResultObjectProvider(Class<?> pcClass,
         JDBCStore store, JDBCFetchConfiguration fetch, Result res) {
         this(store.getConfiguration().getMappingRepositoryInstance().getMapping
             (pcClass, store.getContext().getClassLoader(), true),
@@ -122,8 +122,7 @@
 
     public void handleCheckedException(Exception e) {
         if (e instanceof SQLException)
-            throw SQLExceptions.getStore((SQLException) e,
-                _store.getDBDictionary());
+            throw SQLExceptions.getStore((SQLException) e, _store.getDBDictionary(), _fetch.getReadLockLevel());
         throw new StoreException(e);
     }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?rev=835190&r1=835189&r2=835190&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Thu Nov 12 02:04:12 2009
@@ -106,7 +106,7 @@
     private boolean _active = false;
 
     // track the pending statements so we can cancel them
-    private Set _stmnts = Collections.synchronizedSet(new HashSet());
+    private Set<Statement> _stmnts = Collections.synchronizedSet(new HashSet<Statement>());
 
     private static final Constructor<ClientConnection> clientConnectionImpl;
     private static final Constructor<RefCountConnection> refCountConnectionImpl;
@@ -293,8 +293,7 @@
         } catch (ClassNotFoundException cnfe) {
             throw new UserException(cnfe);
         } catch (SQLException se) {
-            throw SQLExceptions.getStoreSQLException(sm, se, _dict,
-                fetch.getReadLockLevel());
+            throw SQLExceptions.getStore(se, _dict, fetch.getReadLockLevel());
         }
     }
 
@@ -346,7 +345,7 @@
 
             // figure out what type of object this is; the state manager
             // only guarantees to provide a base class
-            Class type;
+            Class<?> type;
             if ((type = getType(res, mapping)) == null) {
                 if (res.getBaseMapping() != null)
                     mapping = res.getBaseMapping();
@@ -413,15 +412,15 @@
                 Object coll =  owner.fetchObject(fms[i].getIndex());
                 if (coll instanceof Map)
                     coll = ((Map)coll).values();
-                if (coll instanceof Collection && 
-                    ((Collection) coll).size() > 0) {
+                if (coll instanceof Collection<?> && 
+                    ((Collection<?>) coll).size() > 0) {
                     // Found eagerly loaded collection.
                     // Publisher (1) <==>  (M) Magazine
                     //    publisher has a EAGER OneToMany relation
                     //    magazine has a EAGER or LAZY ManyToOne publisher
                     // For each member (Magazine) in the collection, 
                     // set its inverse relation (Publisher).
-                    for (Iterator itr = ((Collection) coll).iterator();
+                    for (Iterator<?> itr = ((Collection<?>) coll).iterator();
                         itr.hasNext();) {
                         PersistenceCapable pc = (PersistenceCapable) itr.next();
 
@@ -485,7 +484,7 @@
      * This method is to provide override for non-JDBC or JDBC-like 
      * implementation of getting type from the result set.
      */
-    protected Class getType(Result res, ClassMapping mapping){
+    protected Class<?> getType(Result res, ClassMapping mapping){
         if (res == null)
             return mapping.getDescribedType();
         return null;
@@ -646,7 +645,7 @@
         } catch (ClassNotFoundException cnfe) {
             throw new StoreException(cnfe);
         } catch (SQLException se) {
-            throw SQLExceptions.getStore(se, _dict);
+            throw SQLExceptions.getStore(se, _dict, lockLevel);
         }
     }
 
@@ -682,15 +681,15 @@
         // we want to allow a different thread to be able to cancel the
         // outstanding statement on a different context
 
-        Collection stmnts;
+        Collection<Statement> stmnts;
         synchronized (_stmnts) {
             if (_stmnts.isEmpty())
                 return false;
-            stmnts = new ArrayList(_stmnts);
+            stmnts = new ArrayList<Statement>(_stmnts);
         }
 
         try {
-            for (Iterator itr = stmnts.iterator(); itr.hasNext();)
+            for (Iterator<Statement> itr = stmnts.iterator(); itr.hasNext();)
                 ((Statement) itr.next()).cancel();
             return true;
         } catch (SQLException se) {
@@ -724,13 +723,13 @@
         return true;
     }
 
-    public Class getManagedType(Object oid) {
+    public Class<?> getManagedType(Object oid) {
         if (oid instanceof Id)
             return ((Id) oid).getType();
         return null;
     }
 
-    public Class getDataStoreIdType(ClassMetaData meta) {
+    public Class<?> getDataStoreIdType(ClassMetaData meta) {
         return Id.class;
     }
 

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java?rev=835190&r1=835189&r2=835190&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PessimisticLockManager.java
Thu Nov 12 02:04:12 2009
@@ -137,8 +137,7 @@
                 checkLock(rs, sm, timeout);
             }
         } catch (SQLException se) {
-            throw SQLExceptions.getStoreSQLException(sm, se, dict,
-                level);
+            throw SQLExceptions.getStore(se, dict, level);
         } finally {
             if (stmnt != null)
                 try { stmnt.close(); } catch (SQLException se) {}

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java?rev=835190&r1=835189&r2=835190&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/SelectResultObjectProvider.java
Thu Nov 12 02:04:12 2009
@@ -152,8 +152,7 @@
 
     public void handleCheckedException(Exception e) {
         if (e instanceof SQLException)
-            throw SQLExceptions.getStore((SQLException) e,
-                _store.getDBDictionary());
+            throw SQLExceptions.getStore((SQLException) e, _store.getDBDictionary(), _fetch.getReadLockLevel());
         throw new StoreException(e);
     }
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLExceptions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLExceptions.java?rev=835190&r1=835189&r2=835190&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLExceptions.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLExceptions.java
Thu Nov 12 02:04:12 2009
@@ -65,9 +65,25 @@
     /**
      * Convert the specified exception into a {@link StoreException}.
      */
+    public static OpenJPAException getStore(SQLException se,
+        DBDictionary dict, int level) {
+        return getStore(se.getMessage(), se, dict, level);
+    }
+
+    /**
+     * Convert the specified exception into a {@link StoreException}.
+     */
     public static OpenJPAException getStore(SQLException se, Object failed,
         DBDictionary dict) {
-        return getStore(se.getMessage(), se, failed, dict);
+        return getStore(se.getMessage(), se, failed, dict, -1);
+    }
+
+    /**
+     * Convert the specified exception into a {@link StoreException}.
+     */
+    public static OpenJPAException getStore(SQLException se, Object failed,
+        DBDictionary dict, int level) {
+        return getStore(se.getMessage(), se, failed, dict, level);
     }
 
     /**
@@ -75,7 +91,15 @@
      */
     public static OpenJPAException getStore(Message msg, SQLException se,
         DBDictionary dict) {
-        return getStore(msg.getMessage(), se, null, dict);
+        return getStore(msg.getMessage(), se, null, dict, -1);
+    }
+
+    /**
+     * Convert the specified exception into a {@link StoreException}.
+     */
+    public static OpenJPAException getStore(Message msg, SQLException se,
+        DBDictionary dict, int level) {
+        return getStore(msg.getMessage(), se, null, dict, level);
     }
 
     /**
@@ -83,7 +107,15 @@
      */
     public static OpenJPAException getStore(String msg, SQLException se,
         DBDictionary dict) {
-        return getStore(msg, se, null, dict);
+        return getStore(msg, se, null, dict, -1);
+    }
+
+    /**
+     * Convert the specified exception into a {@link StoreException}.
+     */
+    public static OpenJPAException getStore(String msg, SQLException se,
+        DBDictionary dict, int level) {
+        return getStore(msg, se, null, dict, level);
     }
 
     /**
@@ -91,18 +123,29 @@
      */
     public static OpenJPAException getStore(String msg, SQLException se,
         Object failed, DBDictionary dict) {
+        return getStore(msg, se, failed, dict, -1);
+    }
+
+    /**
+     * Convert the specified exception into a {@link StoreException}.
+     */
+    public static OpenJPAException getStore(String msg, SQLException se,
+        Object failed, DBDictionary dict, int level) {
         if (msg == null)
             msg = se.getClass().getName();
         SQLException[] ses = getSQLExceptions(se);
-        if (dict == null)
-            return new StoreException(msg).setFailedObject(failed).
-                setNestedThrowables(ses);
-        return dict.newStoreException(msg, ses, failed);
+        OpenJPAException storeEx = (dict == null) ? new StoreException(msg).setFailedObject(failed)
+                .setNestedThrowables(ses) : dict.newStoreException(msg, ses, failed);
+        if (level != -1 && storeEx.getSubtype() == StoreException.LOCK) {
+            LockException lockEx = (LockException) storeEx;
+            lockEx.setLockLevel(level);
+        }
+        return storeEx;
     }
     
     /**
-     * Returns an array of {@link SQLException} instances for the
-     * specified exception.
+     * Returns an array of {@link SQLException} instances for the specified
+     * exception.
      */
     private static SQLException[] getSQLExceptions(SQLException se) {
         if (se == null)
@@ -115,21 +158,4 @@
         }
         return (SQLException[]) errs.toArray(new SQLException[errs.size()]);
     }
-    
-    public static OpenJPAException getStoreSQLException(OpenJPAStateManager sm,
-        SQLException se, DBDictionary dict, int level) {
-        return getStoreSQLException(sm.getContext().getConfiguration(), se,
-            dict, level);
-    }
-    
-    public static OpenJPAException getStoreSQLException(
-        OpenJPAConfiguration config, SQLException se, DBDictionary dict,
-        int level) {
-        OpenJPAException storeEx = SQLExceptions.getStore(se, dict);
-        if (storeEx.getSubtype() == StoreException.LOCK) {
-            LockException lockEx = (LockException) storeEx;
-            lockEx.setLockLevel(level);
-        }
-        return storeEx;
-    }
 }

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java?rev=835190&r1=835189&r2=835190&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java
(original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java
Thu Nov 12 02:04:12 2009
@@ -25,8 +25,14 @@
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
+import javax.persistence.NamedQuery;
 import javax.persistence.Version;
 
+@NamedQuery(
+        name="findEmployeeById"
+        , query="SELECT c FROM LockEmployee c WHERE c.id = :id"
+        )
+
 @Entity
 public class LockEmployee implements Externalizable {
 

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java?rev=835190&r1=835189&r2=835190&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java
(original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/SequencedActionsTest.java
Thu Nov 12 02:04:12 2009
@@ -33,7 +33,10 @@
 
 import javax.persistence.EntityManager;
 import javax.persistence.LockModeType;
+import javax.persistence.Query;
 
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
 import org.apache.openjpa.lib.log.Log;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
@@ -193,6 +196,8 @@
         FindWithLock,      // (int id, LockModeType lockType,
                            //      [String properties, Object value]*)
         FindObject,        // (Object obj, LockModeType lockType)
+        NamedQueryWithLock,// (String namedQuery, int id, LockModeType lockType,
+                           //      [String properties, Object value]*)
         Refresh,           // ([int id])
         RefreshWithLock,   // (int id, LockModeType lockType,
                            //      [String properties, Object value]*)
@@ -384,6 +389,39 @@
                         (LockModeType) args[3]);
                     // log.trace("Employee=" + employee);
                     break;
+                case NamedQueryWithLock:
+                    String namedQuery = "????";
+                    if (args.length > 1) {
+                        namedQuery = (String)args[1];
+                    }
+                    id = 1;
+                    if (args.length > 2) {
+                        id = (Integer)args[2];
+                    }
+                    lockMode = null;
+                    if (args.length > 3) {
+                        lockMode = (LockModeType)args[3];
+                    }
+                    Map<String, Object> queryProps = buildPropsMap(args, 4);
+                    //TypedQuery<LockEmployee> q = em.createNamedQuery(namedQuery,
LockEmployee.class);
+                    Query q = em.createNamedQuery(namedQuery);
+                    if( lockMode != null) {
+                        q.setLockMode(lockMode);
+                    }
+                    if( queryProps != null) {
+                        for( String name : queryProps.keySet()) {
+                            q.setHint(name, queryProps.get(name));
+                        }
+                    }
+                    q.setParameter("id", id);
+                    employee = (LockEmployee)q.getSingleResult();
+                    log.trace("Employee=" + employee);
+                    if( employee != null ) {
+                        employees.put(id, employee);
+                    } else {
+                        employees.remove(id);
+                    }
+                    break;
                 case Persist:
                     id = 1;
                     if (args[1] != null) {
@@ -931,4 +969,21 @@
             }
         }
     }
+
+    protected enum DBType {
+        access, db2, derby, empress, foxpro, h2, hsql, informix, ingres, jdatastore, mysql,
oracle, pointbase, postgres,
+        sqlserver, sybase
+    };
+
+    protected DBType getDBType(EntityManager em) {
+        JDBCConfigurationImpl conf = (JDBCConfigurationImpl) getConfiguration(em);
+        String dictClassName = getConfiguration(em).getDBDictionaryInstance().getClass().getName();
+        String db = conf.dbdictionaryPlugin.alias(dictClassName);
+        return DBType.valueOf(db);
+    }
+
+    @SuppressWarnings( { "unused", "deprecation" })
+    protected JDBCConfiguration getConfiguration(EntityManager em) {
+        return ((JDBCConfiguration) ((OpenJPAEntityManager) em).getConfiguration());
+    }
 }

Added: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java?rev=835190&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java
(added)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java
Thu Nov 12 02:04:12 2009
@@ -0,0 +1,133 @@
+/*
+ * 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.persistence.lockmgr;
+
+import java.util.Arrays;
+
+import javax.persistence.EntityManager;
+import javax.persistence.LockModeType;
+
+/**
+ * Test EntityManager find/namedQuery deadlock exceptions.
+ */
+public class TestMixedLockManagerDeadlock extends SequencedActionsTest {
+    private DBType dbType;
+    
+    public void setUp() {
+        setSupportedDatabases(
+                org.apache.openjpa.jdbc.sql.DerbyDictionary.class,
+                org.apache.openjpa.jdbc.sql.OracleDictionary.class,
+                org.apache.openjpa.jdbc.sql.DB2Dictionary.class);
+        if (isTestsDisabled()) {
+            return;
+        }
+
+        setUp(LockEmployee.class
+            , "openjpa.LockManager", "mixed"
+        );
+        commonSetUp();
+        EntityManager em = emf.createEntityManager();
+        dbType = getDBType(em);
+    }
+
+    /* ======== Find dead lock exception test ============*/
+    public void testFindDeadLockException() {
+        commonFindTest("testFindDeadLockException", LockModeType.WRITE, dbType == DBType.oracle
? null
+                : ExpectingOptimisticLockExClass);
+        commonFindTest("testFindDeadLockException", LockModeType.PESSIMISTIC_WRITE, ExpectingAnyLockExClass);
+    }
+
+    private void commonFindTest( String testName, 
+        LockModeType t1Lock, Class<?>[] t1Exceptions ) {
+        String[] parameters = new String[] { "Thread 1: lock= " + t1Lock + ", expectedEx=
"
+                + Arrays.toString(t1Exceptions) };
+            
+        Object[][] threadMain = {
+            {Act.CreateEm},
+            {Act.StartTx},
+            
+            {Act.FindWithLock, 1, t1Lock},
+            {Act.Flush},            
+            
+            {Act.NewThread, 1 },
+            {Act.StartThread, 1 },
+
+            {Act.Wait, 0},
+            {Act.FindWithLock, 2, t1Lock},                        
+            
+            {Act.WaitAllChildren},
+            {Act.TestException, 1, t1Exceptions},
+        };
+        Object[][] thread1 = {
+            {Act.CreateEm},
+            {Act.StartTx},
+            {Act.FindWithLock, 2, t1Lock},            
+            {Act.Flush},            
+
+            {Act.Notify, 0},
+            {Act.FindWithLock, 1, t1Lock},            
+
+            {Act.RollbackTx},
+        };
+        launchActionSequence(testName, parameters, threadMain, thread1);
+    }
+    
+    /* ======== named query dead lock exception test ============*/
+    public void testNamedQueryDeadLockException() {
+        commonNamedQueryTest("testNamedQueryDeadLockException", LockModeType.WRITE, dbType
== DBType.oracle ? null
+                : ExpectingOptimisticLockExClass);
+        commonNamedQueryTest("testNamedQueryDeadLockException", LockModeType.PESSIMISTIC_FORCE_INCREMENT,
+                ExpectingAnyLockExClass);
+    }
+
+    private void commonNamedQueryTest( String testName, 
+        LockModeType t1Lock, Class<?>[] t1Exceptions ) {
+        String[] parameters = new String[] { "Thread 1: lock= " + t1Lock + ", expectedEx=
"
+                + Arrays.toString(t1Exceptions) };
+            
+        Object[][] threadMain = {
+            {Act.CreateEm},
+            {Act.StartTx},
+            
+            {Act.NamedQueryWithLock, "findEmployeeById", 1, t1Lock, "openjpa.hint.IgnorePreparedQuery",
true},
+            {Act.Flush},            
+            
+            {Act.NewThread, 1 },
+            {Act.StartThread, 1 },
+
+            {Act.Wait, 0},
+            {Act.NamedQueryWithLock, "findEmployeeById", 2, t1Lock, "openjpa.hint.IgnorePreparedQuery",
true},                        
+            
+            {Act.WaitAllChildren},
+            {Act.TestException, 1, t1Exceptions},
+        };
+        Object[][] thread1 = {
+            {Act.CreateEm},
+            {Act.StartTx},
+            {Act.NamedQueryWithLock, "findEmployeeById", 2, t1Lock, "openjpa.hint.IgnorePreparedQuery",
true},            
+            {Act.Flush},            
+
+            {Act.Notify, 0},
+            {Act.NamedQueryWithLock, "findEmployeeById", 1, t1Lock, "openjpa.hint.IgnorePreparedQuery",
true},            
+
+            {Act.RollbackTx},
+        };
+        launchActionSequence(testName, parameters, threadMain, thread1);
+    }
+}

Propchange: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestMixedLockManagerDeadlock.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message