package org.opendaylight.mdsal.binding.api;
import com.google.common.annotations.Beta;
-import javax.annotation.concurrent.NotThreadSafe;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.binding.DataContainer;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
/**
* A cursor holding a logical position within a conceptual data tree. It allows operations relative to that position,
* as well as moving the position up or down the tree.
+ *
+ * <p>
+ * Implementations of this interface are expected to be inherently non-thread-safe.
*/
@Beta
-@NotThreadSafe
public interface DataTreeCursor extends AutoCloseable {
/**
* Move the cursor to the specified child of the current position.
import java.util.Map;
import java.util.Optional;
import javax.annotation.concurrent.GuardedBy;
-import javax.annotation.concurrent.ThreadSafe;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingLazyContainerNode;
/**
* A {@link ContainerNode} backed by a binding {@link DataObject}, with lazy instantiation of the ContainerNode view.
+ * This class is thread-safe.
*
* @param <T> Binding DataObject type
* @author Robert Varga
*/
@Beta
-@ThreadSafe
public abstract class AbstractBindingLazyContainerNode<T extends DataObject, C> extends ForwardingObject
implements BindingLazyContainerNode<T> {
private final @NonNull NodeIdentifier identifier;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.annotation.concurrent.NotThreadSafe;
import org.opendaylight.mdsal.binding.model.api.JavaTypeName;
import org.opendaylight.mdsal.binding.model.api.Type;
import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTOBuilder;
import org.opendaylight.mdsal.binding.model.api.type.builder.GeneratedTypeBuilder;
import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
+import org.opendaylight.yangtools.concepts.Mutable;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@NotThreadSafe
-public final class ModuleContext {
+/**
+ * Utility class for building up Binding mapping information. This class is NOT thread-safe.
+ */
+public final class ModuleContext implements Mutable {
private static final Logger LOG = LoggerFactory.getLogger(ModuleContext.class);
private final BiMap<Type, AugmentationSchemaNode> typeToAugmentation = HashBiMap.create();
import javassist.LoaderClassPath;
import javassist.NotFoundException;
import javax.annotation.concurrent.GuardedBy;
-import javax.annotation.concurrent.ThreadSafe;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Users of this utility class are expected to synchronize on this instance
- * it they need to ensure atomic operations on it.
+ * Users of this utility class are expected to synchronize on this instance it they need to ensure atomic operations
+ * on it. Individual operations are synchronized and therefore are thread-safe.
*/
@NonNullByDefault
-@ThreadSafe
public final class JavassistUtils {
private static final Logger LOG = LoggerFactory.getLogger(JavassistUtils.class);
private static final Map<ClassPool, JavassistUtils> INSTANCES = new WeakHashMap<>();
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import javax.annotation.concurrent.NotThreadSafe;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.binding.model.api.Enumeration;
/**
* Abstract class representing a generated type, either top-level or nested. It takes care of tracking references
- * to other Java types and resolving them as best as possible.
+ * to other Java types and resolving them as best as possible. This class is NOT thread-safe.
*
* @author Robert Varga
*/
@NonNullByDefault
-@NotThreadSafe
abstract class AbstractJavaGeneratedType {
private final Map<JavaTypeName, @Nullable String> nameCache = new HashMap<>();
private final ImmutableMap<String, NestedJavaGeneratedType> enclosedTypes;
import com.google.common.annotations.Beta;
import java.util.Arrays;
-import javax.annotation.concurrent.NotThreadSafe;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodeContainer;
/**
* A cursor holding a logical position within a conceptual data tree. It allows operations relative
* to that position, as well as moving the position up or down the tree.
+ *
+ * <p>
+ * Implementations of this interface are expected to be inherently not-thread-safe.
*/
@Beta
-@NotThreadSafe
public interface DOMDataTreeCursor extends AutoCloseable {
/**
* Move the cursor to the specified child of the current position.
import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.annotation.concurrent.GuardedBy;
-import javax.annotation.concurrent.NotThreadSafe;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@NotThreadSafe
final class ShardedDOMDataTreeWriteTransaction implements DOMDataTreeCursorAwareTransaction {
private static final Logger LOG = LoggerFactory.getLogger(ShardedDOMDataTreeWriteTransaction.class);
private static final AtomicLong COUNTER = new AtomicLong();
import com.google.common.annotations.Beta;
import java.util.EnumMap;
import java.util.Map;
-import javax.annotation.concurrent.NotThreadSafe;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.slf4j.LoggerFactory;
/**
- * Prefix table indexed by {@link DOMDataTreeIdentifier}.
- * Stores values in tree and provides lookup of closest ancestor
+ * Prefix table indexed by {@link DOMDataTreeIdentifier}. Stores values in tree and provides lookup of closest ancestor.
+ * This class is not thread-safe.
*
* @param <V> Value type
*/
@Beta
-@NotThreadSafe
public final class DOMDataTreePrefixTable<V> {
private static final Logger LOG = LoggerFactory.getLogger(DOMDataTreePrefixTable.class);
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import javax.annotation.concurrent.NotThreadSafe;
import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.concepts.Mutable;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * An entry in DOMDataTreePrefixTable. This class is not thread-safe.
+ */
@Beta
-@NotThreadSafe
-public final class DOMDataTreePrefixTableEntry<V> implements Identifiable<PathArgument> {
+public final class DOMDataTreePrefixTableEntry<V> implements Identifiable<PathArgument>, Mutable {
private static final Logger LOG = LoggerFactory.getLogger(DOMDataTreePrefixTableEntry.class);
// FIXME: We do probably want to adapt map
private final Map<PathArgument, DOMDataTreePrefixTableEntry<V>> children = new HashMap<>();
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.mdsal.dom.spi.shard;
import static com.google.common.base.Preconditions.checkState;
import com.google.common.annotations.Beta;
import com.google.common.util.concurrent.ListenableFuture;
-import javax.annotation.concurrent.NotThreadSafe;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteCursor;
import org.opendaylight.yangtools.concepts.Identifiable;
+import org.opendaylight.yangtools.concepts.Mutable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * A handle for a transaction being done on a different shard. This class is not thread-safe.
+ */
@Beta
-@NotThreadSafe
-public final class ForeignShardModificationContext implements Identifiable<DOMDataTreeIdentifier> {
+public final class ForeignShardModificationContext implements Identifiable<DOMDataTreeIdentifier>, Mutable {
private static final Logger LOG = LoggerFactory.getLogger(ForeignShardModificationContext.class);
private final DOMDataTreeIdentifier identifier;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.mdsal.dom.spi.shard;
import static java.util.Objects.requireNonNull;
import com.google.common.annotations.Beta;
import java.util.ArrayList;
import java.util.Collection;
-import javax.annotation.concurrent.NotThreadSafe;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
+import org.opendaylight.yangtools.concepts.Mutable;
/**
* Specification of subshard producer context that's used for building modification factories that span into the
- * subshards.
+ * subshards. This class is not thread-safe.
*/
@Beta
@NonNullByDefault
-@NotThreadSafe
-public final class SubshardProducerSpecification {
+public final class SubshardProducerSpecification implements Mutable {
private final Collection<DOMDataTreeIdentifier> prefixes = new ArrayList<>(1);
private final ChildShardContext shard;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.concurrent.GuardedBy;
-import javax.annotation.concurrent.ThreadSafe;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.eos.common.api.CandidateAlreadyRegisteredException;
import org.opendaylight.mdsal.eos.common.api.EntityOwnershipChangeState;
* @param <G> the GenericEntityOwnershipListener type
* @param <S> the GenericEntityOwnershipService type
*/
-@ThreadSafe
final class ClusterSingletonServiceGroupImpl<P extends Path<P>, E extends GenericEntity<P>,
C extends GenericEntityOwnershipChange<P, E>, G extends GenericEntityOwnershipListener<P, C>,
S extends GenericEntityOwnershipService<P, E, G>> extends ClusterSingletonServiceGroup<P, E, C> {
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentSkipListSet;
-import javax.annotation.concurrent.ThreadSafe;
/**
- * Registry of {@link CloseTracked} instances.
+ * Registry of {@link CloseTracked} instances. This class is thread-safe.
*
* @author Michael Vorburger.ch
*/
-@ThreadSafe
class CloseTrackedRegistry<T extends CloseTracked<T>> {
private final Object anchor;
* course) an expensive operation, and should only be used during
* troubleshooting
*/
- public CloseTrackedRegistry(Object anchor, String createDescription, boolean isDebugContextEnabled) {
+ public CloseTrackedRegistry(final Object anchor, final String createDescription,
+ final boolean isDebugContextEnabled) {
this.anchor = anchor;
this.createDescription = createDescription;
this.isDebugContextEnabled = isDebugContextEnabled;
}
// package protected, not public; only CloseTrackedTrait invokes this
- void add(CloseTracked<T> closeTracked) {
+ void add(final CloseTracked<T> closeTracked) {
tracked.add(closeTracked);
}
// package protected, not public; only CloseTrackedTrait invokes this
- void remove(CloseTracked<T> closeTracked) {
+ void remove(final CloseTracked<T> closeTracked) {
tracked.remove(closeTracked);
}