cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r524077 - in /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src: main/java/org/apache/cayenne/access/ test/java/org/apache/cayenne/access/
Date Fri, 30 Mar 2007 13:25:04 GMT
Author: aadamchik
Date: Fri Mar 30 06:25:01 2007
New Revision: 524077

URL: http://svn.apache.org/viewvc?view=rev&rev=524077
Log:
deprecating DataRowStore constructors that instantiate Eventmanager behind the scenes to avoid
accidental dispatch thread leak (as EM does not do a good job of thread pooling)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataRowStore.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextSharedCacheEmpiricTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataDomainTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataRowStoreTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/MockDataRowStore.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataRowStore.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataRowStore.java?view=diff&rev=524077&r1=524076&r2=524077
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataRowStore.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/cayenne/access/DataRowStore.java
Fri Mar 30 06:25:01 2007
@@ -89,6 +89,9 @@
 
     /**
      * Creates new named DataRowStore with default configuration.
+     * 
+     * @deprecated since 3.0 as it instantiates an EventManager internally that can lead
+     *             to dispatch thread leaks.
      */
     public DataRowStore(String name) {
         this(name, Collections.EMPTY_MAP);
@@ -102,6 +105,8 @@
      *            Can't be null.
      * @param properties Properties map used to configure DataRowStore parameters. Can be
      *            null.
+     * @deprecated since 3.0 as it instantiates an EventManager internally that can lead
+     *             to dispatch thread leaks.
      */
     public DataRowStore(String name, Map properties) {
         this(name, properties, new EventManager());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextSharedCacheEmpiricTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextSharedCacheEmpiricTest.java?view=diff&rev=524077&r1=524076&r2=524077
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextSharedCacheEmpiricTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataContextSharedCacheEmpiricTest.java
Fri Mar 30 06:25:01 2007
@@ -17,15 +17,16 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.access;
 
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.art.Artist;
 import org.apache.cayenne.DataRow;
 import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.PersistenceState;
+import org.apache.cayenne.event.EventManager;
 import org.apache.cayenne.query.SQLTemplate;
 import org.apache.cayenne.query.SelectQuery;
 import org.apache.cayenne.unit.CayenneCase;
@@ -46,7 +47,10 @@
 
         deleteTestData();
 
-        DataRowStore cache = new DataRowStore("cacheTest");
+        DataRowStore cache = new DataRowStore(
+                "cacheTest",
+                Collections.EMPTY_MAP,
+                new EventManager());
 
         c1 = new DataContext((DataChannel) getDomain(), new ObjectStore(cache));
         c2 = new DataContext((DataChannel) getDomain(), new ObjectStore(cache));

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataDomainTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataDomainTest.java?view=diff&rev=524077&r1=524076&r2=524077
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataDomainTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataDomainTest.java
Fri Mar 30 06:25:01 2007
@@ -30,6 +30,7 @@
 import org.apache.cayenne.cache.MockQueryCacheFactory;
 import org.apache.cayenne.cache.QueryCache;
 import org.apache.cayenne.cache.QueryCacheFactory;
+import org.apache.cayenne.event.EventManager;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.unit.CayenneCase;
@@ -339,7 +340,10 @@
 
         final boolean[] cacheShutdown = new boolean[1];
 
-        DataRowStore cache = new DataRowStore("Y") {
+        DataRowStore cache = new DataRowStore(
+                "Y",
+                Collections.EMPTY_MAP,
+                new EventManager()) {
 
             public void shutdown() {
                 cacheShutdown[0] = true;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataRowStoreTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataRowStoreTest.java?view=diff&rev=524077&r1=524076&r2=524077
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataRowStoreTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/DataRowStoreTest.java
Fri Mar 30 06:25:01 2007
@@ -26,6 +26,7 @@
 import org.apache.art.Artist;
 import org.apache.cayenne.DataRow;
 import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.event.EventManager;
 import org.apache.cayenne.unit.CayenneCase;
 
 /**
@@ -34,7 +35,10 @@
 public class DataRowStoreTest extends CayenneCase {
 
     public void testDefaultConstructor() {
-        DataRowStore cache = new DataRowStore("cacheXYZ");
+        DataRowStore cache = new DataRowStore(
+                "cacheXYZ",
+                Collections.EMPTY_MAP,
+                new EventManager());
         assertEquals("cacheXYZ", cache.getName());
         assertNotNull(cache.getSnapshotEventSubject());
         assertTrue(cache.getSnapshotEventSubject().getSubjectName().indexOf("cacheXYZ") >=
0);
@@ -48,14 +52,17 @@
         props.put(DataRowStore.REMOTE_NOTIFICATION_PROPERTY, String
                 .valueOf(!DataRowStore.REMOTE_NOTIFICATION_DEFAULT));
 
-        DataRowStore cache = new DataRowStore("cacheXYZ", props);
+        DataRowStore cache = new DataRowStore("cacheXYZ", props, new EventManager());
         assertEquals("cacheXYZ", cache.getName());
         assertEquals(!DataRowStore.REMOTE_NOTIFICATION_DEFAULT, cache
                 .isNotifyingRemoteListeners());
     }
 
     public void testNotifyingRemoteListeners() {
-        DataRowStore cache = new DataRowStore("cacheXYZ");
+        DataRowStore cache = new DataRowStore(
+                "cacheXYZ",
+                Collections.EMPTY_MAP,
+                new EventManager());
 
         assertEquals(DataRowStore.REMOTE_NOTIFICATION_DEFAULT, cache
                 .isNotifyingRemoteListeners());
@@ -72,7 +79,7 @@
         Map props = new HashMap();
         props.put(DataRowStore.SNAPSHOT_CACHE_SIZE_PROPERTY, String.valueOf(2));
 
-        DataRowStore cache = new DataRowStore("cacheXYZ", props);
+        DataRowStore cache = new DataRowStore("cacheXYZ", props, new EventManager());
         assertEquals(2, cache.maximumSize());
         assertEquals(0, cache.size());
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/MockDataRowStore.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/MockDataRowStore.java?view=diff&rev=524077&r1=524076&r2=524077
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/MockDataRowStore.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/access/MockDataRowStore.java
Fri Mar 30 06:25:01 2007
@@ -17,7 +17,6 @@
  *  under the License.
  ****************************************************************/
 
-
 package org.apache.cayenne.access;
 
 import java.util.HashMap;
@@ -25,6 +24,7 @@
 
 import org.apache.cayenne.DataRow;
 import org.apache.cayenne.ObjectId;
+import org.apache.cayenne.event.EventManager;
 
 /**
  * A "lightweight" DataRowStore.
@@ -41,7 +41,7 @@
     }
 
     public MockDataRowStore() {
-        super("mock DataRowStore", TEST_DEFAULTS);
+        super("mock DataRowStore", TEST_DEFAULTS, new EventManager());
     }
 
     /**



Mime
View raw message