package org.opendaylight.yangtools.yang.data.util.codec;
import com.google.common.annotations.Beta;
-import javax.annotation.concurrent.ThreadSafe;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.TypedDataSchemaNode;
/**
- * A no-operation codec cache.
+ * A no-operation codec cache. This class is thread-safe.
*
* @author Robert Varga
*
* @param <T> Codec type
*/
@Beta
-@ThreadSafe
public final class NoopCodecCache<T> extends CodecCache<T> {
private static final NoopCodecCache<?> INSTANCE = new NoopCodecCache<>();
import com.google.common.annotations.Beta;
import java.util.Map;
-import javax.annotation.concurrent.ThreadSafe;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.TypedDataSchemaNode;
/**
- * Pre-computed CodecCache. All possible codecs are created upfront at instantiation time, after which they are
- * available for the cost of a constant lookup.
+ * Pre-computed thread-safe CodecCache. All possible codecs are created upfront at instantiation time, after which they
+ * are available for the cost of a constant lookup.
*
* <p>
* Instantiation needs to occur through {@link LazyCodecCache#toPrecomputed()} after the lazy cache has been fully
* @author Robert Varga
*/
@Beta
-@ThreadSafe
public final class PrecomputedCodecCache<T> extends CodecCache<T> {
private final Map<TypeDefinition<?>, T> simpleCodecs;
private final Map<TypedDataSchemaNode, T> complexCodecs;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.util.concurrent.ExecutionException;
-import javax.annotation.concurrent.ThreadSafe;
import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
import org.opendaylight.yangtools.yang.model.api.TypedDataSchemaNode;
* @author Robert Varga
*/
@Beta
-@ThreadSafe
public final class SharedCodecCache<T> extends CodecCache<T> {
// Weak keys to force identity lookup
// Soft values to keep unreferenced codecs around for a bit, but eventually we want them to go away