private static final Logger LOG = LoggerFactory.getLogger(ReadOnlyTrieMap.class);
private final TrieMap<K, V> readWrite;
private final int size;
- private TrieMap<K, V> readOnly;
+ private volatile TrieMap<K, V> readOnly;
ReadOnlyTrieMap(final TrieMap<K, V> map, final int size) {
super();
@Override
protected Map<K, V> delegate() {
- if (readOnly == null) {
+ TrieMap<K, V> ret = readOnly;
+ if (ret == null) {
synchronized (this) {
- if (readOnly == null) {
- readOnly = readWrite.readOnlySnapshot();
+ ret = readOnly;
+ if (ret == null) {
+ ret = readWrite.readOnlySnapshot();
+ readOnly = ret;
}
}
}
- return readOnly;
+ return ret;
}
@Override
}
final TypeDefinition<?> baseType = XmlUtils.resolveBaseTypeFrom(schema.getType());
- if (baseType instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifier) {
+ if (baseType instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType) {
value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx);
} else if(baseType instanceof IdentityrefTypeDefinition){
value = InstanceIdentifierForXmlCodec.toIdentity(xmlElement.getTextContent(), xmlElement, schemaCtx);
if (codec != null) {
value = codec.deserialize(text);
}
- if (schema.getType() instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifier) {
+ if (schema.getType() instanceof org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType) {
value = InstanceIdentifierForXmlCodec.deserialize(xmlElement,schemaCtx);
}
if (value == null) {
} else if ("empty".equals(typeName)) {
return EmptyType.getInstance();
} else if ("instance-identifier".equals(typeName)) {
- return InstanceIdentifier.getInstance();
+ return InstanceIdentifierType.getInstance();
}
return null;
}
* @see InstanceIdentifierTypeDefinition
*
*/
-public final class InstanceIdentifier implements InstanceIdentifierTypeDefinition, Immutable {
+public final class InstanceIdentifierType implements InstanceIdentifierTypeDefinition, Immutable {
private static final QName NAME = BaseTypes.INSTANCE_IDENTIFIER_QNAME;
private static final SchemaPath PATH = SchemaPath.create(true, NAME);
private static final String UNITS = "";
private final Boolean requireInstance;
- private static final InstanceIdentifier INSTANCE_WITH_REQUIRED_TRUE = new InstanceIdentifier(true);
- private static final InstanceIdentifier INSTANCE_WITH_REQUIRED_FALSE = new InstanceIdentifier(false);
+ private static final InstanceIdentifierType INSTANCE_WITH_REQUIRED_TRUE = new InstanceIdentifierType(true);
+ private static final InstanceIdentifierType INSTANCE_WITH_REQUIRED_FALSE = new InstanceIdentifierType(false);
/**
* Constructs new instance identifier.
* @deprecated Use {@link #getInstance()} for default one, since Instance Identifier does not have xpath.
*/
@Deprecated
- public InstanceIdentifier(final RevisionAwareXPath xpath) {
+ public InstanceIdentifierType(final RevisionAwareXPath xpath) {
requireInstance = true;
}
* @deprecated Use {@link #create(boolean)}, since Instance Identifier does not have xpath.
*/
@Deprecated
- public InstanceIdentifier(final RevisionAwareXPath xpath, final boolean requireInstance) {
+ public InstanceIdentifierType(final RevisionAwareXPath xpath, final boolean requireInstance) {
this.requireInstance = requireInstance;
}
- private InstanceIdentifier(final boolean requiredInstance) {
+ private InstanceIdentifierType(final boolean requiredInstance) {
this.requireInstance = requiredInstance;
}
- public static InstanceIdentifier getInstance() {
+ public static InstanceIdentifierType getInstance() {
return INSTANCE_WITH_REQUIRED_TRUE;
}
- public static InstanceIdentifier create(final boolean requireInstance) {
+ public static InstanceIdentifierType create(final boolean requireInstance) {
return requireInstance ? INSTANCE_WITH_REQUIRED_TRUE : INSTANCE_WITH_REQUIRED_FALSE;
}
if (getClass() != obj.getClass()) {
return false;
}
- InstanceIdentifier other = (InstanceIdentifier) obj;
+ InstanceIdentifierType other = (InstanceIdentifierType) obj;
return requireInstance.equals(other.requireInstance);
}
* <dt>uint64</dt>
* <dd>64-bit unsigned integer -{@link org.opendaylight.yangtools.yang.model.util.Int64}</dd>
* <dt>instance-identifier</dt>
- * <dd>References a data tree node - {@link org.opendaylight.yangtools.yang.model.util.InstanceIdentifier}</dd>
+ * <dd>References a data tree node - {@link org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType}</dd>
* <dt>string</dt>
* <dd>{@link org.opendaylight.yangtools.yang.model.util.StringType}</dd>
* </dl>
import org.opendaylight.yangtools.yang.model.util.Decimal64;
import org.opendaylight.yangtools.yang.model.util.EnumerationType;
import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.model.util.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType;
import org.opendaylight.yangtools.yang.model.util.Int16;
import org.opendaylight.yangtools.yang.model.util.Int32;
import org.opendaylight.yangtools.yang.model.util.Int64;
constraints.addLengths(binaryType.getLengthConstraints());
baseType = binaryType;
} else if ("instance-identifier".equals(typeName)) {
- return InstanceIdentifier.create(isRequireInstance(typeBody));
+ return InstanceIdentifierType.create(isRequireInstance(typeBody));
}
if (parent instanceof TypeDefinitionBuilder && !(parent instanceof UnionTypeBuilder)) {
import org.opendaylight.yangtools.yang.model.util.EnumerationType;
import org.opendaylight.yangtools.yang.model.util.ExtendedType;
import org.opendaylight.yangtools.yang.model.util.IdentityrefType;
-import org.opendaylight.yangtools.yang.model.util.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType;
import org.opendaylight.yangtools.yang.model.util.UnionType;
public class TypesResolutionTest {
public void testInstanceIdentifier1() {
Module tested = TestUtils.findModule(testedModules, "custom-types-test");
LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf1");
- InstanceIdentifier leafType = (InstanceIdentifier) leaf.getType();
+ InstanceIdentifierType leafType = (InstanceIdentifierType) leaf.getType();
assertFalse(leafType.requireInstance());
assertEquals(1, leaf.getUnknownSchemaNodes().size());
}
public void testInstanceIdentifier2() {
Module tested = TestUtils.findModule(testedModules, "custom-types-test");
LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf2");
- InstanceIdentifier leafType = (InstanceIdentifier) leaf.getType();
+ InstanceIdentifierType leafType = (InstanceIdentifierType) leaf.getType();
assertTrue(leafType.requireInstance());
}