You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/10/29 15:13:21 UTC
[1/6] ignite git commit: IGNITE-1803: WIP.
Repository: ignite
Updated Branches:
refs/heads/ignite-1803 [created] 7ab23028b
IGNITE-1803: WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e80d69d8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e80d69d8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e80d69d8
Branch: refs/heads/ignite-1803
Commit: e80d69d88baa5bccaa061826964c36e204d25c26
Parents: 7eedab1
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Oct 29 16:07:13 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Oct 29 16:07:13 2015 +0300
----------------------------------------------------------------------
.../internal/portable/PortableSchema.java | 223 +++++++++++++++++++
.../portable/PortableSchemaRegistry.java | 171 ++++++++++++++
.../apache/ignite/portable/PortableObject.java | 9 +
.../portable/PortableObjectFieldDescriptor.java | 39 ++++
4 files changed, 442 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e80d69d8/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
new file mode 100644
index 0000000..09bfe35
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchema.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Schema describing portable object content. We rely on the following assumptions:
+ * - When amount of fields in the object is low, it is better to inline these values into int fields thus allowing
+ * for quick comparisons performed within already fetched L1 cache line.
+ * - When there are more fields, we store them inside a hash map.
+ */
+public class PortableSchema {
+ /** Inline flag. */
+ private final boolean inline;
+
+ /** Map with offsets. */
+ private final HashMap<Integer, Integer> map;
+
+ /** ID 1. */
+ private final int id1;
+
+ /** Offset 1. */
+ private final int offset1;
+
+ /** ID 2. */
+ private final int id2;
+
+ /** Offset 2. */
+ private final int offset2;
+
+ /** ID 3. */
+ private final int id3;
+
+ /** Offset 3. */
+ private final int offset3;
+
+ /** ID 4. */
+ private final int id4;
+
+ /** Offset 4. */
+ private final int offset4;
+
+ /** ID 1. */
+ private final int id5;
+
+ /** Offset 1. */
+ private final int offset5;
+
+ /** ID 2. */
+ private final int id6;
+
+ /** Offset 2. */
+ private final int offset6;
+
+ /** ID 3. */
+ private final int id7;
+
+ /** Offset 3. */
+ private final int offset7;
+
+ /** ID 4. */
+ private final int id8;
+
+ /** Offset 4. */
+ private final int offset8;
+
+ /**
+ * Constructor.
+ *
+ * @param vals Values.
+ */
+ public PortableSchema(LinkedHashMap<Integer, Integer> vals) {
+ if (vals.size() <= 8) {
+ inline = true;
+
+ Iterator<Map.Entry<Integer, Integer>> iter = vals.entrySet().iterator();
+
+ Map.Entry<Integer, Integer> entry = iter.hasNext() ? iter.next() : null;
+
+ if (entry != null) {
+ id1 = entry.getKey();
+ offset1 = entry.getValue();
+ }
+ else{
+ id1 = 0;
+ offset1 = 0;
+ }
+
+ if ((entry = iter.hasNext() ? iter.next() : null) != null) {
+ id2 = entry.getKey();
+ offset2 = entry.getValue();
+ }
+ else{
+ id2 = 0;
+ offset2 = 0;
+ }
+
+ if ((entry = iter.hasNext() ? iter.next() : null) != null) {
+ id3 = entry.getKey();
+ offset3 = entry.getValue();
+ }
+ else{
+ id3 = 0;
+ offset3 = 0;
+ }
+
+ if ((entry = iter.hasNext() ? iter.next() : null) != null) {
+ id4 = entry.getKey();
+ offset4 = entry.getValue();
+ }
+ else{
+ id4 = 0;
+ offset4 = 0;
+ }
+
+ if ((entry = iter.hasNext() ? iter.next() : null) != null) {
+ id5 = entry.getKey();
+ offset5 = entry.getValue();
+ }
+ else{
+ id5 = 0;
+ offset5 = 0;
+ }
+
+ if ((entry = iter.hasNext() ? iter.next() : null) != null) {
+ id6 = entry.getKey();
+ offset6 = entry.getValue();
+ }
+ else{
+ id6 = 0;
+ offset6 = 0;
+ }
+
+ if ((entry = iter.hasNext() ? iter.next() : null) != null) {
+ id7 = entry.getKey();
+ offset7 = entry.getValue();
+ }
+ else{
+ id7 = 0;
+ offset7 = 0;
+ }
+
+ if ((entry = iter.hasNext() ? iter.next() : null) != null) {
+ id8 = entry.getKey();
+ offset8 = entry.getValue();
+ }
+ else{
+ id8 = 0;
+ offset8 = 0;
+ }
+
+ map = null;
+ }
+ else {
+ inline = false;
+
+ id1 = id2 = id3 = id4 = id5 = id6 = id7 = id8 = 0;
+ offset1 = offset2 = offset3 = offset4 = offset5 = offset6 = offset7 = offset8 = 0;
+
+ map = new HashMap<>(vals);
+ }
+ }
+
+ /**
+ * Get offset for the given field ID.
+ *
+ * @param id Field ID.
+ * @return Offset or {@code 0} if there is no such field.
+ */
+ public int offset(int id) {
+ if (inline) {
+ if (id == id1)
+ return offset1;
+
+ if (id == id2)
+ return offset2;
+
+ if (id == id3)
+ return offset3;
+
+ if (id == id4)
+ return offset4;
+
+ if (id == id5)
+ return offset5;
+
+ if (id == id6)
+ return offset6;
+
+ if (id == id7)
+ return offset7;
+
+ if (id == id8)
+ return offset8;
+
+ return 0;
+ }
+ else {
+ Integer off = map.get(id);
+
+ return off != null ? off : 0;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e80d69d8/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchemaRegistry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchemaRegistry.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchemaRegistry.java
new file mode 100644
index 0000000..88c3cce
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableSchemaRegistry.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.jetbrains.annotations.Nullable;
+
+import java.util.HashMap;
+
+/**
+ * Portable schema registry. Contains all well-known object schemas.
+ * <p>
+ * We rely on the fact that usually object has only few different schemas. For this reason we inline several
+ * of them with optional fallback to normal hash map lookup.
+ *
+ */
+public class PortableSchemaRegistry {
+ /** Empty schema ID. */
+ private static final int EMPTY = 0;
+
+ /** Whether registry still works in inline mode. */
+ private volatile boolean inline = true;
+
+ /** First schema ID. */
+ private int schemaId1;
+
+ /** Second schema ID. */
+ private int schemaId2;
+
+ /** Third schema ID. */
+ private int schemaId3;
+
+ /** Fourth schema ID. */
+ private int schemaId4;
+
+ /** First schema. */
+ private PortableSchema schema1;
+
+ /** Second schema. */
+ private PortableSchema schema2;
+
+ /** Third schema. */
+ private PortableSchema schema3;
+
+ /** Fourth schema. */
+ private PortableSchema schema4;
+
+ /** Schemas with COW semantics. */
+ private volatile HashMap<Integer, PortableSchema> schemas;
+
+ /**
+ * Get schema for the given ID. We rely on very relaxed memory semantics here assuming that it is not critical
+ * to return false-positive {@code null} values.
+ *
+ * @param schemaId Schema ID.
+ * @return Schema or {@code null}.
+ */
+ @Nullable public PortableSchema schema(int schemaId) {
+ if (inline) {
+ if (schemaId == schemaId1)
+ return schema1;
+ else if (schemaId == schemaId2)
+ return schema2;
+ else if (schemaId == schemaId3)
+ return schema3;
+ else if (schemaId == schemaId4)
+ return schema4;
+ }
+ else {
+ HashMap<Integer, PortableSchema> schemas0 = schemas;
+
+ // Null can be observed here due to either data race or race condition when switching to non-inlined mode.
+ // Both of them are benign for us because they lead only to unnecessary schema re-calc.
+ if (schemas0 != null)
+ return schemas0.get(schemaId);
+ }
+
+ return null;
+ }
+
+ /**
+ * Add schema.
+ *
+ * @param schemaId Schema ID.
+ * @param schema Schema.
+ */
+ public void addSchema(int schemaId, PortableSchema schema) {
+ synchronized (this) {
+ if (inline) {
+ // Check if this is already known schema.
+ if (schemaId == schemaId1 || schemaId == schemaId2 || schemaId == schemaId3 || schemaId == schemaId4)
+ return;
+
+ // Try positioning new schema in inline mode.
+ if (schemaId1 == EMPTY) {
+ schemaId1 = schemaId;
+
+ schema1 = schema;
+
+ inline = true; // Forcing HB edge just in case.
+
+ return;
+ }
+
+ if (schemaId2 == EMPTY) {
+ schemaId2 = schemaId;
+
+ schema2 = schema;
+
+ inline = true; // Forcing HB edge just in case.
+
+ return;
+ }
+
+ if (schemaId3 == EMPTY) {
+ schemaId3 = schemaId;
+
+ schema3 = schema;
+
+ inline = true; // Forcing HB edge just in case.
+
+ return;
+ }
+
+ if (schemaId4 == EMPTY) {
+ schemaId4 = schemaId;
+
+ schema4 = schema;
+
+ inline = true; // Forcing HB edge just in case.
+
+ return;
+ }
+
+ // No luck, switching to hash map mode.
+ HashMap<Integer, PortableSchema> newSchemas = new HashMap<>();
+
+ newSchemas.put(schemaId1, schema1);
+ newSchemas.put(schemaId2, schema2);
+ newSchemas.put(schemaId3, schema3);
+ newSchemas.put(schemaId4, schema4);
+ newSchemas.put(schemaId, schema);
+
+ schemas = newSchemas;
+
+ inline = false;
+ }
+ else {
+ HashMap<Integer, PortableSchema> newSchemas = new HashMap<>(schemas);
+
+ newSchemas.put(schemaId, schema);
+
+ schemas = newSchemas;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e80d69d8/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
index 66b8f76..08c6622 100644
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
@@ -137,6 +137,15 @@ public interface PortableObject extends Serializable, Cloneable {
public boolean hasField(String fieldName);
/**
+ * Gets field descriptor.
+ *
+ * @param fieldName Field name.
+ * @return Field descriptor.
+ * @throws PortableException If failed.
+ */
+ public PortableObjectFieldDescriptor fieldDescriptor(String fieldName) throws PortableException;
+
+ /**
* Gets fully deserialized instance of portable object.
*
* @return Fully deserialized instance of portable object.
http://git-wip-us.apache.org/repos/asf/ignite/blob/e80d69d8/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java
new file mode 100644
index 0000000..182233a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.portable;
+
+/**
+ * Portable object field. Can be used to speed object field lookup.
+ */
+public interface PortableObjectFieldDescriptor {
+ /**
+ * Check whether field exists in the object.
+ *
+ * @param obj Object.
+ * @return {@code True} if exists.
+ */
+ public boolean exists(PortableObject obj);
+
+ /**
+ * Get field's value from the given object.
+ *
+ * @param obj Object.
+ * @return Value.
+ */
+ public <T> T value(PortableObject obj);
+}
[2/6] ignite git commit: Merge branch 'ignite-1770' into ignite-1803
Posted by vo...@apache.org.
Merge branch 'ignite-1770' into ignite-1803
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a91b98dd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a91b98dd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a91b98dd
Branch: refs/heads/ignite-1803
Commit: a91b98ddc2cdcd35463542e5b117d6b750382f5e
Parents: e80d69d 42da3fa
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Oct 29 16:10:41 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Oct 29 16:10:41 2015 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/portable/PortableReaderExImpl.java | 3 +--
.../org/apache/ignite/internal/portable/PortableWriterExImpl.java | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
[4/6] ignite git commit: IGNITE-1803: WIP.
Posted by vo...@apache.org.
IGNITE-1803: WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a7e0741a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a7e0741a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a7e0741a
Branch: refs/heads/ignite-1803
Commit: a7e0741a1ee34072331304b000ff7183bc33d160
Parents: 3b4e63932
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Oct 29 17:11:02 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Oct 29 17:11:02 2015 +0300
----------------------------------------------------------------------
.../portable/PortableFIeldDescriptorImpl.java | 82 --------------------
.../portable/PortableFIeldDescriptorImpl2.java | 82 ++++++++++++++++++++
.../internal/portable/PortableObjectImpl.java | 2 +-
.../portable/PortableObjectOffheapImpl.java | 2 +-
4 files changed, 84 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7e0741a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
deleted file mode 100644
index 10fad1d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import org.apache.ignite.portable.PortableFieldDescriptor;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * Implementation of portable field descriptor.
- */
-public class PortableFIeldDescriptorImpl implements PortableFieldDescriptor {
- /** Well-known object schemas. */
- private final PortableSchemaRegistry schemas;
-
- /** Pre-calculated field ID. */
- private final int fieldId;
-
- /**
- * Constructor.
- *
- * @param schemas Schemas.
- * @param fieldId Field ID.
- */
- public PortableFIeldDescriptorImpl(PortableSchemaRegistry schemas, int fieldId) {
- this.schemas = schemas;
- this.fieldId = fieldId;
- }
-
- /** {@inheritDoc} */
- @Override public boolean exists(PortableObject obj) {
- PortableObjectEx obj0 = (PortableObjectEx)obj;
-
- return fieldOffset(obj0) != 0;
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override public <T> T value(PortableObject obj) {
- PortableObjectEx obj0 = (PortableObjectEx)obj;
-
- int offset = fieldOffset(obj0);
-
- return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
- }
-
- /**
- * Get relative field offset.
- *
- * @param obj Object.
- * @return Field offset.
- */
- private int fieldOffset(PortableObjectEx obj) {
- int schemaId = obj.schemaId();
-
- PortableSchema schema = schemas.schema(schemaId);
-
- if (schema == null) {
- schema = obj.createSchema();
-
- schemas.addSchema(schemaId, schema);
- }
-
- assert schema != null;
-
- return schema.offset(fieldId);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7e0741a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
new file mode 100644
index 0000000..0775b52
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.portable.PortableFieldDescriptor;
+import org.apache.ignite.portable.PortableObject;
+
+/**
+ * Implementation of portable field descriptor.
+ */
+public class PortableFIeldDescriptorImpl2 implements PortableFieldDescriptor {
+ /** Well-known object schemas. */
+ private final PortableSchemaRegistry schemas;
+
+ /** Pre-calculated field ID. */
+ private final int fieldId;
+
+ /**
+ * Constructor.
+ *
+ * @param schemas Schemas.
+ * @param fieldId Field ID.
+ */
+ public PortableFIeldDescriptorImpl2(PortableSchemaRegistry schemas, int fieldId) {
+ this.schemas = schemas;
+ this.fieldId = fieldId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean exists(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ return fieldOffset(obj0) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public <T> T value(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ int offset = fieldOffset(obj0);
+
+ return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
+ }
+
+ /**
+ * Get relative field offset.
+ *
+ * @param obj Object.
+ * @return Field offset.
+ */
+ private int fieldOffset(PortableObjectEx obj) {
+ int schemaId = obj.schemaId();
+
+ PortableSchema schema = schemas.schema(schemaId);
+
+ if (schema == null) {
+ schema = obj.createSchema();
+
+ schemas.addSchema(schemaId, schema);
+ }
+
+ assert schema != null;
+
+ return schema.offset(fieldId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7e0741a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
index 84cb812..897605b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
@@ -327,7 +327,7 @@ public final class PortableObjectImpl extends PortableObjectEx implements Extern
int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
- return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
+ return new PortableFIeldDescriptorImpl2(schemaReg, fieldId);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7e0741a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
index b6ffa59..b6e988b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
@@ -124,7 +124,7 @@ public class PortableObjectOffheapImpl extends PortableObjectEx implements Exter
int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
- return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
+ return new PortableFIeldDescriptorImpl2(schemaReg, fieldId);
}
/** {@inheritDoc} */
[6/6] ignite git commit: IGNITE-1803: WIP.
Posted by vo...@apache.org.
IGNITE-1803: WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ab23028
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ab23028
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ab23028
Branch: refs/heads/ignite-1803
Commit: 7ab23028ba8fc0c6c02f1e6e4c25e20d146bb4ae
Parents: c4195ee
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Oct 29 17:14:04 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Oct 29 17:14:04 2015 +0300
----------------------------------------------------------------------
.../portable/PortableFIeldDescriptorImpl.java | 82 --------------------
.../portable/PortableFIeldDescriptorImpl2.java | 82 ++++++++++++++++++++
.../internal/portable/PortableObjectImpl.java | 2 +-
.../portable/PortableObjectOffheapImpl.java | 2 +-
4 files changed, 84 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ab23028/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
deleted file mode 100644
index 10fad1d..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import org.apache.ignite.portable.PortableFieldDescriptor;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * Implementation of portable field descriptor.
- */
-public class PortableFIeldDescriptorImpl implements PortableFieldDescriptor {
- /** Well-known object schemas. */
- private final PortableSchemaRegistry schemas;
-
- /** Pre-calculated field ID. */
- private final int fieldId;
-
- /**
- * Constructor.
- *
- * @param schemas Schemas.
- * @param fieldId Field ID.
- */
- public PortableFIeldDescriptorImpl(PortableSchemaRegistry schemas, int fieldId) {
- this.schemas = schemas;
- this.fieldId = fieldId;
- }
-
- /** {@inheritDoc} */
- @Override public boolean exists(PortableObject obj) {
- PortableObjectEx obj0 = (PortableObjectEx)obj;
-
- return fieldOffset(obj0) != 0;
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override public <T> T value(PortableObject obj) {
- PortableObjectEx obj0 = (PortableObjectEx)obj;
-
- int offset = fieldOffset(obj0);
-
- return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
- }
-
- /**
- * Get relative field offset.
- *
- * @param obj Object.
- * @return Field offset.
- */
- private int fieldOffset(PortableObjectEx obj) {
- int schemaId = obj.schemaId();
-
- PortableSchema schema = schemas.schema(schemaId);
-
- if (schema == null) {
- schema = obj.createSchema();
-
- schemas.addSchema(schemaId, schema);
- }
-
- assert schema != null;
-
- return schema.offset(fieldId);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ab23028/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
new file mode 100644
index 0000000..0775b52
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.portable.PortableFieldDescriptor;
+import org.apache.ignite.portable.PortableObject;
+
+/**
+ * Implementation of portable field descriptor.
+ */
+public class PortableFIeldDescriptorImpl2 implements PortableFieldDescriptor {
+ /** Well-known object schemas. */
+ private final PortableSchemaRegistry schemas;
+
+ /** Pre-calculated field ID. */
+ private final int fieldId;
+
+ /**
+ * Constructor.
+ *
+ * @param schemas Schemas.
+ * @param fieldId Field ID.
+ */
+ public PortableFIeldDescriptorImpl2(PortableSchemaRegistry schemas, int fieldId) {
+ this.schemas = schemas;
+ this.fieldId = fieldId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean exists(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ return fieldOffset(obj0) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public <T> T value(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ int offset = fieldOffset(obj0);
+
+ return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
+ }
+
+ /**
+ * Get relative field offset.
+ *
+ * @param obj Object.
+ * @return Field offset.
+ */
+ private int fieldOffset(PortableObjectEx obj) {
+ int schemaId = obj.schemaId();
+
+ PortableSchema schema = schemas.schema(schemaId);
+
+ if (schema == null) {
+ schema = obj.createSchema();
+
+ schemas.addSchema(schemaId, schema);
+ }
+
+ assert schema != null;
+
+ return schema.offset(fieldId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ab23028/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
index 84cb812..897605b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
@@ -327,7 +327,7 @@ public final class PortableObjectImpl extends PortableObjectEx implements Extern
int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
- return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
+ return new PortableFIeldDescriptorImpl2(schemaReg, fieldId);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ab23028/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
index b6ffa59..b6e988b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
@@ -124,7 +124,7 @@ public class PortableObjectOffheapImpl extends PortableObjectEx implements Exter
int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
- return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
+ return new PortableFIeldDescriptorImpl2(schemaReg, fieldId);
}
/** {@inheritDoc} */
[3/6] ignite git commit: IGNITE-1803: Implemented. old implementation
works.
Posted by vo...@apache.org.
IGNITE-1803: Implemented. old implementation works.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3b4e6393
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3b4e6393
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3b4e6393
Branch: refs/heads/ignite-1803
Commit: 3b4e6393217cbbab42e393b66b7f615fbb73e9de
Parents: a91b98d
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Oct 29 17:10:50 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Oct 29 17:10:50 2015 +0300
----------------------------------------------------------------------
.../internal/portable/PortableContext.java | 100 ++++-----------
.../portable/PortableFIeldDescriptorImpl.java | 82 ++++++++++++
.../internal/portable/PortableObjectEx.java | 24 +++-
.../internal/portable/PortableObjectImpl.java | 43 ++++++-
.../portable/PortableObjectOffheapImpl.java | 38 ++++++
.../internal/portable/PortableReaderExImpl.java | 128 +++++++++++--------
.../portable/PortableFieldDescriptor.java | 39 ++++++
.../apache/ignite/portable/PortableObject.java | 2 +-
.../portable/PortableObjectFieldDescriptor.java | 39 ------
9 files changed, 327 insertions(+), 168 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 0265a55..d8cb0be 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -156,7 +156,7 @@ public class PortableContext implements Externalizable {
private boolean keepDeserialized;
/** Object schemas. */
- private volatile Map<Integer, Object> schemas;
+ private volatile Map<Integer, PortableSchemaRegistry> schemas;
/**
* For {@link Externalizable}.
@@ -857,95 +857,51 @@ public class PortableContext implements Externalizable {
}
/**
- * Get schema for the given schema ID.
+ * Get schema registry for type ID.
*
- * @param schemaId Schema ID.
- * @return Schema or {@code null} if there are no such schema.
+ * @param typeId Type ID.
+ * @return Schema registry for type ID.
*/
- @SuppressWarnings("unchecked")
- @Nullable public PortableObjectSchema schema(int typeId, int schemaId) {
- Map<Integer, Object> schemas0 = schemas;
-
- if (schemas0 != null) {
- Object typeSchemas = schemas0.get(typeId);
-
- if (typeSchemas instanceof IgniteBiTuple) {
- // The most common case goes first.
- IgniteBiTuple<Integer, PortableObjectSchema> schema =
- (IgniteBiTuple<Integer, PortableObjectSchema>)typeSchemas;
+ public PortableSchemaRegistry schemaRegistry(int typeId) {
+ Map<Integer, PortableSchemaRegistry> schemas0 = schemas;
- if (schema.get1() == schemaId)
- return schema.get2();
- }
- else if (typeSchemas instanceof Map) {
- Map<Integer, PortableObjectSchema> curSchemas = (Map<Integer, PortableObjectSchema>)typeSchemas;
-
- return curSchemas.get(schemaId);
- }
- }
-
- return null;
- }
-
- /**
- * Add schema.
- *
- * @param schemaId Schema ID.
- * @param newTypeSchema New schema.
- */
- @SuppressWarnings("unchecked")
- public void addSchema(int typeId, int schemaId, PortableObjectSchema newTypeSchema) {
- synchronized (this) {
- if (schemas == null) {
- // This is the very first schema recorded.
- Map<Integer, Object> newSchemas = new HashMap<>();
+ if (schemas0 == null) {
+ synchronized (this) {
+ schemas0 = schemas;
- newSchemas.put(typeId, new IgniteBiTuple<>(schemaId, newTypeSchema));
+ if (schemas0 == null) {
+ schemas0 = new HashMap<>();
- schemas = newSchemas;
- }
- else {
- Object typeSchemas = schemas.get(typeId);
+ PortableSchemaRegistry reg = new PortableSchemaRegistry();
- if (typeSchemas == null) {
- // This is the very first object schema.
- Map<Integer, Object> newSchemas = new HashMap<>(schemas);
+ schemas0.put(typeId, reg);
- newSchemas.put(typeId, new IgniteBiTuple<>(schemaId, newTypeSchema));
+ schemas = schemas0;
- schemas = newSchemas;
+ return reg;
}
- else if (typeSchemas instanceof IgniteBiTuple) {
- IgniteBiTuple<Integer, PortableObjectSchema> typeSchema =
- (IgniteBiTuple<Integer, PortableObjectSchema>)typeSchemas;
-
- if (typeSchema.get1() != schemaId) {
- Map<Integer, PortableObjectSchema> newTypeSchemas = new HashMap();
-
- newTypeSchemas.put(typeSchema.get1(), typeSchema.get2());
- newTypeSchemas.put(schemaId, newTypeSchema);
-
- Map<Integer, Object> newSchemas = new HashMap<>(schemas);
+ }
+ }
- newSchemas.put(typeId, newTypeSchemas);
+ PortableSchemaRegistry reg = schemas0.get(typeId);
- schemas = newSchemas;
- }
- }
- else {
- Map<Integer, PortableObjectSchema> newTypeSchemas =
- new HashMap((Map<Integer, PortableObjectSchema>)typeSchemas);
+ if (reg == null) {
+ synchronized (this) {
+ reg = schemas.get(typeId);
- newTypeSchemas.put(schemaId, newTypeSchema);
+ if (reg == null) {
+ reg = new PortableSchemaRegistry();
- Map<Integer, Object> newSchemas = new HashMap<>(schemas);
+ schemas0 = new HashMap<>(schemas);
- newSchemas.put(typeId, newTypeSchemas);
+ schemas0.put(typeId, reg);
- schemas = newSchemas;
+ schemas = schemas0;
}
}
}
+
+ return reg;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
new file mode 100644
index 0000000..10fad1d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.portable.PortableFieldDescriptor;
+import org.apache.ignite.portable.PortableObject;
+
+/**
+ * Implementation of portable field descriptor.
+ */
+public class PortableFIeldDescriptorImpl implements PortableFieldDescriptor {
+ /** Well-known object schemas. */
+ private final PortableSchemaRegistry schemas;
+
+ /** Pre-calculated field ID. */
+ private final int fieldId;
+
+ /**
+ * Constructor.
+ *
+ * @param schemas Schemas.
+ * @param fieldId Field ID.
+ */
+ public PortableFIeldDescriptorImpl(PortableSchemaRegistry schemas, int fieldId) {
+ this.schemas = schemas;
+ this.fieldId = fieldId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean exists(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ return fieldOffset(obj0) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public <T> T value(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ int offset = fieldOffset(obj0);
+
+ return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
+ }
+
+ /**
+ * Get relative field offset.
+ *
+ * @param obj Object.
+ * @return Field offset.
+ */
+ private int fieldOffset(PortableObjectEx obj) {
+ int schemaId = obj.schemaId();
+
+ PortableSchema schema = schemas.schema(schemaId);
+
+ if (schema == null) {
+ schema = obj.createSchema();
+
+ schemas.addSchema(schemaId, schema);
+ }
+
+ assert schema != null;
+
+ return schema.offset(fieldId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
index ef9ee24..42c973b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectEx.java
@@ -67,12 +67,34 @@ public abstract class PortableObjectEx implements PortableObject {
@Nullable public abstract <F> F field(int fieldId) throws PortableException;
/**
+ * Get field by offset.
+ *
+ * @param fieldOffset Field offset.
+ * @return Field value.
+ */
+ @Nullable protected abstract <F> F fieldByOffset(int fieldOffset);
+
+ /**
* @param ctx Reader context.
* @param fieldName Field name.
- * @return Field name.
+ * @return Field value.
*/
@Nullable protected abstract <F> F field(PortableReaderContext ctx, String fieldName);
+ /**
+ * Get schema ID.
+ *
+ * @return Schema ID.
+ */
+ protected abstract int schemaId();
+
+ /**
+ * Create schema for object.
+ *
+ * @return Schema.
+ */
+ protected abstract PortableSchema createSchema();
+
/** {@inheritDoc} */
@Override public PortableObject clone() throws CloneNotSupportedException {
return (PortableObject)super.clone();
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
index f1868b1..84cb812 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
@@ -17,11 +17,6 @@
package org.apache.ignite.internal.portable;
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.nio.ByteBuffer;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.IgniteCodeGeneratingFail;
@@ -35,10 +30,17 @@ import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.portable.PortableFieldDescriptor;
import org.apache.ignite.portable.PortableMetadata;
import org.apache.ignite.portable.PortableObject;
import org.jetbrains.annotations.Nullable;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.nio.ByteBuffer;
+
/**
* Portable object implementation.
*/
@@ -248,6 +250,14 @@ public final class PortableObjectImpl extends PortableObjectEx implements Extern
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
+ @Nullable @Override protected <F> F fieldByOffset(int fieldOffset) {
+ PortableReaderExImpl reader = new PortableReaderExImpl(ctx, arr, start, null);
+
+ return (F)reader.unmarshalFieldByOffset(fieldOffset);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Nullable @Override protected <F> F field(PortableReaderContext rCtx, String fieldName) {
PortableReaderExImpl reader = new PortableReaderExImpl(ctx,
new PortableHeapInputStream(arr),
@@ -298,6 +308,29 @@ public final class PortableObjectImpl extends PortableObjectEx implements Extern
}
/** {@inheritDoc} */
+ @Override protected int schemaId() {
+ return PRIM.readInt(arr, start + GridPortableMarshaller.SCHEMA_ID_POS);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected PortableSchema createSchema() {
+ PortableReaderExImpl reader = new PortableReaderExImpl(ctx, arr, start, null);
+
+ return reader.createSchema();
+ }
+
+ /** {@inheritDoc} */
+ @Override public PortableFieldDescriptor fieldDescriptor(String fieldName) throws PortableException {
+ int typeId = typeId();
+
+ PortableSchemaRegistry schemaReg = ctx.schemaRegistry(typeId);
+
+ int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
+
+ return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
+ }
+
+ /** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
index 0b3e3ea..b6ffa59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.plugin.extensions.communication.MessageReader;
import org.apache.ignite.plugin.extensions.communication.MessageWriter;
import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.portable.PortableFieldDescriptor;
import org.apache.ignite.portable.PortableMetadata;
import org.apache.ignite.portable.PortableObject;
import org.jetbrains.annotations.Nullable;
@@ -101,6 +102,32 @@ public class PortableObjectOffheapImpl extends PortableObjectEx implements Exter
}
/** {@inheritDoc} */
+ @Override protected int schemaId() {
+ return UNSAFE.getInt(ptr + start + GridPortableMarshaller.SCHEMA_ID_POS);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected PortableSchema createSchema() {
+ PortableReaderExImpl reader = new PortableReaderExImpl(ctx,
+ new PortableOffheapInputStream(ptr, size, false),
+ start,
+ null);
+
+ return reader.createSchema();
+ }
+
+ /** {@inheritDoc} */
+ @Override public PortableFieldDescriptor fieldDescriptor(String fieldName) throws PortableException {
+ int typeId = typeId();
+
+ PortableSchemaRegistry schemaReg = ctx.schemaRegistry(typeId);
+
+ int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
+
+ return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
+ }
+
+ /** {@inheritDoc} */
@Override public int start() {
return start;
}
@@ -152,6 +179,17 @@ public class PortableObjectOffheapImpl extends PortableObjectEx implements Exter
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
+ @Nullable @Override protected <F> F fieldByOffset(int fieldOffset) {
+ PortableReaderExImpl reader = new PortableReaderExImpl(ctx,
+ new PortableOffheapInputStream(ptr, size, false),
+ start,
+ null);
+
+ return (F)reader.unmarshalFieldByOffset(fieldOffset);
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
@Nullable @Override protected <F> F field(PortableReaderContext rCtx, String fieldName) {
PortableReaderExImpl reader = new PortableReaderExImpl(ctx,
new PortableOffheapInputStream(ptr, size, false),
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
index 7736826..9a20a1c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableReaderExImpl.java
@@ -47,6 +47,7 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
@@ -160,7 +161,7 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
private int schemaId;
/** Object schema. */
- private PortableObjectSchema schema;
+ private PortableSchema schema;
/**
* @param ctx Context.
@@ -303,6 +304,21 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
}
/**
+ * @param fieldOffset Field offset.
+ * @return Unmarshalled value.
+ * @throws PortableException In case of error.
+ */
+ @Nullable Object unmarshalFieldByOffset(int fieldOffset) throws PortableException {
+ parseHeaderIfNeeded();
+
+ int offset = in.readIntPositioned(footerStart + fieldOffset);
+
+ in.position(start + offset);
+
+ return unmarshal();
+ }
+
+ /**
* @param fieldId Field ID.
* @return Value.
* @throws PortableException In case of error.
@@ -2528,68 +2544,80 @@ public class PortableReaderExImpl implements PortableReader, PortableRawReaderEx
}
/**
+ * Create schema.
+ *
+ * @return Schema.
+ */
+ public PortableSchema createSchema() {
+ parseHeaderIfNeeded();
+
+ LinkedHashMap<Integer, Integer> fields = new LinkedHashMap<>();
+
+ int searchPos = footerStart;
+
+ while (searchPos < footerEnd) {
+ int fieldId = in.readIntPositioned(searchPos);
+
+ fields.put(fieldId, searchPos + 4 - footerStart);
+
+ searchPos += 8;
+ }
+
+ return new PortableSchema(fields);
+ }
+
+ /**
* @param id Field ID.
* @return Field offset.
*/
private boolean hasField(int id) {
- // TODO: Constant-time lookup.
-// if (schema == null) {
-// PortableObjectSchema schema0 = ctx.schema(typeId, schemaId);
-//
-// if (schema0 == null) {
-// Map<Integer, Integer> fields = new HashMap<>(256, 0.5f);
-//
-// int searchPos = footerStart;
-//
-// while (searchPos < footerEnd) {
-// int fieldId = in.readIntPositioned(searchPos);
-//
-// fields.put(fieldId, searchPos + 4 - footerStart);
-//
-// searchPos += 8;
-// }
-//
-// schema0 = new PortableObjectSchema(schemaId, fields);
-//
-// ctx.addSchema(typeId, schemaId, schema0);
-// }
-//
-// schema = schema0;
-// }
-//
-// int fieldOffsetPos = schema.fieldOffsetPosition(id);
-//
-// if (fieldOffsetPos != 0) {
-// int fieldOffset = in.readIntPositioned(footerStart + fieldOffsetPos);
-//
-// in.position(start + fieldOffset);
-//
-// return true;
-// }
-// else
-// return false;
+ if (schema == null) {
+ PortableSchemaRegistry schemaReg = ctx.schemaRegistry(typeId);
- assert hdrLen != 0;
+ PortableSchema schema0 = schemaReg.schema(schemaId);
- int searchHead = footerStart;
- int searchTail = footerEnd;
+ if (schema0 == null) {
+ schema0 = createSchema();
- while (true) {
- if (searchHead >= searchTail)
- return false;
+ schemaReg.addSchema(schemaId, schema0);
+ }
- int id0 = in.readIntPositioned(searchHead);
+ schema = schema0;
+ }
- if (id0 == id) {
- int offset = in.readIntPositioned(searchHead + 4);
+ int fieldOffsetPos = schema.offset(id);
- in.position(start + offset);
+ if (fieldOffsetPos != 0) {
+ int fieldOffset = in.readIntPositioned(footerStart + fieldOffsetPos);
- return true;
- }
+ in.position(start + fieldOffset);
- searchHead += 8;
+ return true;
}
+ else
+ return false;
+
+// assert hdrLen != 0;
+//
+// int searchHead = footerStart;
+// int searchTail = footerEnd;
+//
+// while (true) {
+// if (searchHead >= searchTail)
+// return false;
+//
+// int id0 = in.readIntPositioned(searchHead);
+//
+// if (id0 == id) {
+// int offset = in.readIntPositioned(searchHead + 4);
+//
+// in.position(start + offset);
+//
+// return true;
+// }
+//
+// searchHead += 8;
+// }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/portable/PortableFieldDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableFieldDescriptor.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableFieldDescriptor.java
new file mode 100644
index 0000000..27700ee
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/portable/PortableFieldDescriptor.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.portable;
+
+/**
+ * Portable object field. Can be used to speed object field lookup.
+ */
+public interface PortableFieldDescriptor {
+ /**
+ * Check whether field exists in the object.
+ *
+ * @param obj Object.
+ * @return {@code True} if exists.
+ */
+ public boolean exists(PortableObject obj);
+
+ /**
+ * Get field's value from the given object.
+ *
+ * @param obj Object.
+ * @return Value.
+ */
+ public <T> T value(PortableObject obj);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
index 08c6622..1df45a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
+++ b/modules/core/src/main/java/org/apache/ignite/portable/PortableObject.java
@@ -143,7 +143,7 @@ public interface PortableObject extends Serializable, Cloneable {
* @return Field descriptor.
* @throws PortableException If failed.
*/
- public PortableObjectFieldDescriptor fieldDescriptor(String fieldName) throws PortableException;
+ public PortableFieldDescriptor fieldDescriptor(String fieldName) throws PortableException;
/**
* Gets fully deserialized instance of portable object.
http://git-wip-us.apache.org/repos/asf/ignite/blob/3b4e6393/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java
deleted file mode 100644
index 182233a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableObjectFieldDescriptor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.portable;
-
-/**
- * Portable object field. Can be used to speed object field lookup.
- */
-public interface PortableObjectFieldDescriptor {
- /**
- * Check whether field exists in the object.
- *
- * @param obj Object.
- * @return {@code True} if exists.
- */
- public boolean exists(PortableObject obj);
-
- /**
- * Get field's value from the given object.
- *
- * @param obj Object.
- * @return Value.
- */
- public <T> T value(PortableObject obj);
-}
[5/6] ignite git commit: IGNITE-1803: WIP.
Posted by vo...@apache.org.
IGNITE-1803: WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c4195ee5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c4195ee5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c4195ee5
Branch: refs/heads/ignite-1803
Commit: c4195ee5ccf9333eee3de5fba7e0ec1efcce0c9c
Parents: a7e0741
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Oct 29 17:12:12 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Oct 29 17:12:12 2015 +0300
----------------------------------------------------------------------
.../portable/PortableFIeldDescriptorImpl.java | 82 ++++++++++++++++++++
.../portable/PortableFIeldDescriptorImpl2.java | 82 --------------------
.../internal/portable/PortableObjectImpl.java | 2 +-
.../portable/PortableObjectOffheapImpl.java | 2 +-
4 files changed, 84 insertions(+), 84 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c4195ee5/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
new file mode 100644
index 0000000..10fad1d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.portable;
+
+import org.apache.ignite.portable.PortableFieldDescriptor;
+import org.apache.ignite.portable.PortableObject;
+
+/**
+ * Implementation of portable field descriptor.
+ */
+public class PortableFIeldDescriptorImpl implements PortableFieldDescriptor {
+ /** Well-known object schemas. */
+ private final PortableSchemaRegistry schemas;
+
+ /** Pre-calculated field ID. */
+ private final int fieldId;
+
+ /**
+ * Constructor.
+ *
+ * @param schemas Schemas.
+ * @param fieldId Field ID.
+ */
+ public PortableFIeldDescriptorImpl(PortableSchemaRegistry schemas, int fieldId) {
+ this.schemas = schemas;
+ this.fieldId = fieldId;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean exists(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ return fieldOffset(obj0) != 0;
+ }
+
+ /** {@inheritDoc} */
+ @SuppressWarnings("unchecked")
+ @Override public <T> T value(PortableObject obj) {
+ PortableObjectEx obj0 = (PortableObjectEx)obj;
+
+ int offset = fieldOffset(obj0);
+
+ return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
+ }
+
+ /**
+ * Get relative field offset.
+ *
+ * @param obj Object.
+ * @return Field offset.
+ */
+ private int fieldOffset(PortableObjectEx obj) {
+ int schemaId = obj.schemaId();
+
+ PortableSchema schema = schemas.schema(schemaId);
+
+ if (schema == null) {
+ schema = obj.createSchema();
+
+ schemas.addSchema(schemaId, schema);
+ }
+
+ assert schema != null;
+
+ return schema.offset(fieldId);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c4195ee5/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
deleted file mode 100644
index 0775b52..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableFIeldDescriptorImpl2.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.portable;
-
-import org.apache.ignite.portable.PortableFieldDescriptor;
-import org.apache.ignite.portable.PortableObject;
-
-/**
- * Implementation of portable field descriptor.
- */
-public class PortableFIeldDescriptorImpl2 implements PortableFieldDescriptor {
- /** Well-known object schemas. */
- private final PortableSchemaRegistry schemas;
-
- /** Pre-calculated field ID. */
- private final int fieldId;
-
- /**
- * Constructor.
- *
- * @param schemas Schemas.
- * @param fieldId Field ID.
- */
- public PortableFIeldDescriptorImpl2(PortableSchemaRegistry schemas, int fieldId) {
- this.schemas = schemas;
- this.fieldId = fieldId;
- }
-
- /** {@inheritDoc} */
- @Override public boolean exists(PortableObject obj) {
- PortableObjectEx obj0 = (PortableObjectEx)obj;
-
- return fieldOffset(obj0) != 0;
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("unchecked")
- @Override public <T> T value(PortableObject obj) {
- PortableObjectEx obj0 = (PortableObjectEx)obj;
-
- int offset = fieldOffset(obj0);
-
- return offset != 0 ? (T)obj0.fieldByOffset(offset) : null;
- }
-
- /**
- * Get relative field offset.
- *
- * @param obj Object.
- * @return Field offset.
- */
- private int fieldOffset(PortableObjectEx obj) {
- int schemaId = obj.schemaId();
-
- PortableSchema schema = schemas.schema(schemaId);
-
- if (schema == null) {
- schema = obj.createSchema();
-
- schemas.addSchema(schemaId, schema);
- }
-
- assert schema != null;
-
- return schema.offset(fieldId);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/c4195ee5/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
index 897605b..84cb812 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectImpl.java
@@ -327,7 +327,7 @@ public final class PortableObjectImpl extends PortableObjectEx implements Extern
int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
- return new PortableFIeldDescriptorImpl2(schemaReg, fieldId);
+ return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/c4195ee5/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
index b6e988b..b6ffa59 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableObjectOffheapImpl.java
@@ -124,7 +124,7 @@ public class PortableObjectOffheapImpl extends PortableObjectEx implements Exter
int fieldId = ctx.userTypeIdMapper(typeId).fieldId(typeId, fieldName);
- return new PortableFIeldDescriptorImpl2(schemaReg, fieldId);
+ return new PortableFIeldDescriptorImpl(schemaReg, fieldId);
}
/** {@inheritDoc} */