Annotate Identifier with @ThreadSafe 39/39739/4
authorRobert Varga <rovarga@cisco.com>
Wed, 1 Jun 2016 23:54:36 +0000 (01:54 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Mon, 6 Jun 2016 10:00:55 +0000 (10:00 +0000)
Implementations are expected to be used for maps, hence they are expected
to be used from multiple threads concurrently.

Change-Id: I7578486cc8be843959befb4473461dcd601e904b
Signed-off-by: Robert Varga <rovarga@cisco.com>
common/concepts/src/main/java/org/opendaylight/yangtools/concepts/Identifier.java

index 96696d7b656dd2cd2f8540bc6b0d1270af0dfabf..b673486196fbe34bfd453d24d42a1a5acdb402b4 100644 (file)
@@ -8,20 +8,23 @@
 package org.opendaylight.yangtools.concepts;
 
 import java.io.Serializable;
+import javax.annotation.concurrent.ThreadSafe;
 
 /**
- * General identifier interface. It is primarily a marker for all things that
- * identify concepts -- such as names, addresses, classes, etc. We do not
- * require too much, just that the identifiers are serializable (and this
+ * General identifier interface. It is primarily a marker for all things that identify concepts -- such as names,
+ * addresses, classes, etc. We do not require too much, just that the identifiers are serializable (and this
  * transferable).
  *
- * Implementations are expected to implement hashCode() and equals() methods
- * in a way, which ensures that objects before and after serialization are
- * considered equal.
+ * Implementations are expected to implement {@link #hashCode()} and {@link #equals(Object)} methods in a way, which
+ * ensures that objects before and after serialization are considered equal.
  *
- * Implementations are advised to use the Externalizable Proxy pattern to
- * allow future evolution of their serialization format.
+ * Implementations are advised to use the {@link java.io.Externalizable} Proxy pattern to allow future evolution
+ * of their serialization format. For further efficiency, implementation should implement {@link WritableObject},
+ * so they can be efficiently embedded in other {@link Serializable} objects.
+ *
+ * Note that this class is annotated as {@link ThreadSafe}, hence all implementations are expected to be thread-safe.
  */
+@ThreadSafe
 public interface Identifier extends Serializable, Immutable {
     @Override
     boolean equals(Object o);