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/27 15:32:12 UTC
[07/11] ignite git commit: IGNITE-1770: Cache ID mapper.
IGNITE-1770: Cache ID mapper.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d48d7762
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d48d7762
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d48d7762
Branch: refs/heads/ignite-1770
Commit: d48d77629678f4989b266fb00ded178e4c5b75e8
Parents: 6d9dea3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Oct 27 16:35:23 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Oct 27 16:35:23 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/portable/PortableWriterExImpl.java | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d48d7762/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
index a629010..382b2f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableWriterExImpl.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.portable.streams.PortableHeapOutputStream;
import org.apache.ignite.internal.portable.streams.PortableOutputStream;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.portable.PortableException;
+import org.apache.ignite.portable.PortableIdMapper;
import org.apache.ignite.portable.PortableRawWriter;
import org.apache.ignite.portable.PortableWriter;
import org.jetbrains.annotations.Nullable;
@@ -128,6 +129,9 @@ public class PortableWriterExImpl implements PortableWriter, PortableRawWriterEx
/** Amount of written fields. */
private int fieldCnt;
+ /** ID mapper. */
+ private PortableIdMapper idMapper;
+
/**
* @param ctx Context.
*/
@@ -1639,7 +1643,7 @@ public class PortableWriterExImpl implements PortableWriter, PortableRawWriterEx
/** {@inheritDoc} */
@Override public void writeByte(int v) throws IOException {
- doWriteByte((byte)v);
+ doWriteByte((byte) v);
}
/** {@inheritDoc} */
@@ -1683,7 +1687,10 @@ public class PortableWriterExImpl implements PortableWriter, PortableRawWriterEx
throw new PortableException("Individual field can't be written after raw writer is acquired " +
"via rawWriter() method. Consider fixing serialization logic for class: " + cls.getName());
- int id = ctx.fieldId(typeId, fieldName);
+ if (idMapper == null)
+ idMapper = ctx.idMapper(typeId);
+
+ int id = idMapper.fieldId(typeId, fieldName);
writeFieldId(id);