openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1342715 - in /openjpa/branches/2.2.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-kernel/src/main/java/org/apache/openjpa/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/
Date Fri, 25 May 2012 16:29:43 GMT
Author: curtisr7
Date: Fri May 25 16:29:42 2012
New Revision: 1342715

URL: http://svn.apache.org/viewvc?rev=1342715&view=rev
Log:
OPENJPA-2167 : Misc changes to improve flush() path performance, merged from trunk.

Modified:
    openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/AutoDetachValue.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java

Modified: openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?rev=1342715&r1=1342714&r2=1342715&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
(original)
+++ openjpa/branches/2.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Fri May 25 16:29:42 2012
@@ -109,7 +109,7 @@ public class JDBCStoreManager implements
     private Log _log = null;
     
     // track the pending statements so we can cancel them
-    private Set<Statement> _stmnts = Collections.synchronizedSet(new HashSet<Statement>());
+    private List<Statement> _stmnts = Collections.synchronizedList(new ArrayList<Statement>());
 
     public StoreContext getContext() {
         return _ctx;
@@ -740,7 +740,7 @@ public class JDBCStoreManager implements
         // we want to allow a different thread to be able to cancel the
         // outstanding statement on a different context
 
-        Collection<Statement> stmnts;
+        List<Statement> stmnts;
         synchronized (_stmnts) {
             if (_stmnts.isEmpty())
                 return false;

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/AutoDetachValue.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/AutoDetachValue.java?rev=1342715&r1=1342714&r2=1342715&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/AutoDetachValue.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/AutoDetachValue.java
Fri May 25 16:29:42 2012
@@ -38,12 +38,14 @@ class AutoDetachValue
     public static final String DETACH_COMMIT = "commit";
     public static final String DETACH_ROLLBACK= "rollback";
     public static final String DETACH_NONTXREAD = "nontx-read";
+    public static final String DETACH_NONE = "none";
 
     private static String[] ALIASES = new String[]{
         DETACH_CLOSE, String.valueOf(AutoDetach.DETACH_CLOSE),
         DETACH_COMMIT, String.valueOf(AutoDetach.DETACH_COMMIT),
         DETACH_NONTXREAD, String.valueOf(AutoDetach.DETACH_NONTXREAD),
         DETACH_ROLLBACK, String.valueOf(AutoDetach.DETACH_ROLLBACK),
+        DETACH_NONE, String.valueOf(AutoDetach.DETACH_NONE),
         // for compatibility with JDO DetachAllOnCommit
         "true", String.valueOf(AutoDetach.DETACH_COMMIT),
         "false", "0",

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=1342715&r1=1342714&r2=1342715&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
Fri May 25 16:29:42 2012
@@ -880,7 +880,7 @@ public class BrokerImpl
      * Fire given transaction event, handling any exceptions appropriately.
      */
     private void fireTransactionEvent(TransactionEvent trans) {
-        if (_transEventManager != null)
+        if (_transEventManager != null && _transEventManager.hasListeners())
             handleCallbackExceptions(_transEventManager.fireEvent(trans),
                 _transCallbackMode);
     }

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java?rev=1342715&r1=1342714&r2=1342715&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
Fri May 25 16:29:42 2012
@@ -31,11 +31,11 @@ class ENonTransState
     extends PCState {
 
     void initialize(StateManagerImpl context) {
-        context.setDirty(false);
-        context.clearSavedFields();
-
         // spec says all proxies to second class objects should be reset
         context.proxyFields(true, true);
+
+        context.setDirty(false);
+        context.clearSavedFields();
     }
 
     PCState delete(StateManagerImpl context) {

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java?rev=1342715&r1=1342714&r2=1342715&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
Fri May 25 16:29:42 2012
@@ -38,11 +38,11 @@ class PNonTransState
         (PNonTransState.class);
 
     void initialize(StateManagerImpl context) {
-        context.setDirty(false);
-        context.clearSavedFields();
-
         // spec says all proxies to second class objects should be reset
         context.proxyFields(true, false);
+
+        context.setDirty(false);
+        context.clearSavedFields();
     }
 
     PCState delete(StateManagerImpl context) {

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java?rev=1342715&r1=1342714&r2=1342715&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
Fri May 25 16:29:42 2012
@@ -2973,7 +2973,8 @@ public class StateManagerImpl
         try {
             for (FieldMetaData fmd : _meta.getProxyFields()) {
                 int index = fmd.getIndex();
-                if (_loaded.get(index)) {
+                // only reload if dirty
+                if (_loaded.get(index) && _dirty.get(index)) {
                     provideField(_pc, _single, index);
                     if (_single.proxy(reset, replaceNull)) {
                         replaceField(_pc, _single, index);

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java?rev=1342715&r1=1342714&r2=1342715&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java
Fri May 25 16:29:42 2012
@@ -31,13 +31,13 @@ class TCleanState
     extends PCState {
 
     void initialize(StateManagerImpl context) {
-        context.clearSavedFields();
-        context.setLoaded(true);
-        context.setDirty(false);
-
         // need to replace the second class objects with proxies that
         // listen for dirtying so we can track changes to these objects
         context.proxyFields(true, false);
+
+        context.clearSavedFields();
+        context.setLoaded(true);
+        context.setDirty(false);
     }
 
     PCState persist(StateManagerImpl context) {



Mime
View raw message