sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1470195 - in /sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata: AbstractMetadata.java Cloner.java
Date Sat, 20 Apr 2013 17:09:49 GMT
Author: desruisseaux
Date: Sat Apr 20 17:09:49 2013
New Revision: 1470195

URL: http://svn.apache.org/r1470195
Log:
Edit javadoc after removal of synchronization.

Modified:
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
    sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java?rev=1470195&r1=1470194&r2=1470195&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
[UTF-8] (original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/AbstractMetadata.java
[UTF-8] Sat Apr 20 17:09:49 2013
@@ -39,11 +39,6 @@ import static org.apache.sis.util.Argume
  * Those methods are implemented using Java reflection for invoking the getter methods
  * defined by the {@code MetadataStandard}.</p>
  *
- * {@note This class does not synchronize the methods that perform deep traversal of the
metadata tree
- * (like <code>equals(Object)</code>, <code>hashCode()</code> or
<code>toString()</code>) because such
- * synchronizations are deadlock prone. For example if subclasses synchronize their getter
methods,
- * then many locks may be acquired in various orders.}
- *
  * {@code AbstractMetadata} subclasses may be read-only or read/write, at implementation
choice.
  * The methods that modify the metadata may throw {@link UnmodifiableMetadataException} if
the
  * metadata does not support the operation. Those methods are:
@@ -63,6 +58,11 @@ import static org.apache.sis.util.Argume
  *   <li>{@link #equals(Object, ComparisonMode)}</li>
  * </ul>
  *
+ * Instances of this class are <strong>not</strong> synchronized for multi-threading.
+ * Synchronization, if needed, is caller's responsibility. Note that synchronization locks
+ * are not necessarily the metadata instances. For example an other common approach is to
+ * use a single lock for the whole metadata tree (including children).
+ *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.4)
  * @version 0.3
@@ -241,17 +241,6 @@ public abstract class AbstractMetadata i
                 return false;
             }
         }
-        /*
-         * DEADLOCK WARNING: A deadlock may occur if the same pair of objects is being compared
-         * in an other thread (see http://jira.codehaus.org/browse/GEOT-1777). Ideally we
would
-         * synchronize on 'this' and 'object' atomically (RFE #4210659). Since we can't in
Java
-         * a workaround is to always get the locks in the same order. Unfortunately we have
no
-         * guarantee that the caller didn't looked the object himself. For now the safest
approach
-         * is to not synchronize at all.
-         *
-         * Edit: actually, even if we could synchronize the two objects atomically, a deadlock
-         *       risk would still exists for the reason documented in this class's javadoc.
-         */
         return standard.equals(this, object, mode);
     }
 

Modified: sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java?rev=1470195&r1=1470194&r2=1470195&view=diff
==============================================================================
--- sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java [UTF-8]
(original)
+++ sis/branches/JDK7/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java [UTF-8]
Sat Apr 20 17:09:49 2013
@@ -98,8 +98,8 @@ final class Cloner extends org.apache.si
                 for (int i=0; i<array.length; i++) {
                     array[i] = clone(array[i]);
                 }
-                // Do not use the SIS Checked* classes since we don't
-                // need synchronization or type checking anymore.
+                // Do not use the SIS Checked* classes since
+                // we don't need type checking anymore.
                 if (isSet) {
                     collection = CollectionsExt.immutableSet(array);
                 } else {



Mime
View raw message