Repository: incubator-ignite Updated Branches: refs/heads/ignite-141 fe2185d04 -> 2d5586e25
IGNITE-141 - Marshallers refactoring Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/a06dc4ab Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/a06dc4ab Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/a06dc4ab Branch: refs/heads/ignite-141 Commit: a06dc4ab44d84a02b767467f6a2892cd423aca80 Parents: 39c7f54 Author: Valentin Kulichenko <vkuliche...@gridgain.com> Authored: Tue Mar 3 13:47:37 2015 -0800 Committer: Valentin Kulichenko <vkuliche...@gridgain.com> Committed: Tue Mar 3 13:47:37 2015 -0800 ---------------------------------------------------------------------- .../ignite/internal/MarshallerContextImpl.java | 24 +++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/a06dc4ab/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java index f06896d..0491aea 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/MarshallerContextImpl.java @@ -74,7 +74,7 @@ public class MarshallerContextImpl implements MarshallerContext { /** {@inheritDoc} */ @Override public void registerClass(int id, Class cls) { - if (clsNameById.putIfAbsent(id, cls.getName()) == null) { + if (!clsNameById.containsKey(id)) { try { if (cache == null) U.awaitQuiet(latch); @@ -85,6 +85,8 @@ public class MarshallerContextImpl implements MarshallerContext { throw new IgniteException("Type ID collision occurred in OptimizedMarshaller. Use " + "OptimizedMarshallerIdMapper to resolve it [id=" + id + ", clsName1=" + cls.getName() + "clsName2=" + old + ']'); + + clsNameById.putIfAbsent(id, cls.getName()); } catch (IgniteCheckedException e) { throw U.convertException(e); @@ -97,22 +99,22 @@ public class MarshallerContextImpl implements MarshallerContext { String clsName = clsNameById.get(id); if (clsName == null) { - if (cache == null) - U.awaitQuiet(latch); - try { + if (cache == null) + U.awaitQuiet(latch); + clsName = cache.get(id); + + assert clsName != null : id; + + String old = clsNameById.putIfAbsent(id, clsName); + + if (old != null) + clsName = old; } catch (IgniteCheckedException e) { throw U.convertException(e); } - - assert clsName != null : id; - - String old = clsNameById.putIfAbsent(id, clsName); - - if (old != null) - clsName = old; } return U.forName(clsName, ldr);