/** * @return Default serializer. */ private BinarySerializer defaultSerializer() { BinaryConfiguration binCfg = igniteCfg.getBinaryConfiguration(); return binCfg != null ? binCfg.getSerializer() : null; }
/** * Sets binary config. * * @param igniteCfg Ignite config. * @param dotNetCfg .NET config. */ private void setBinaryConfiguration(IgniteConfiguration igniteCfg, PlatformDotNetConfigurationEx dotNetCfg) { // Check marshaller. Marshaller marsh = igniteCfg.getMarshaller(); if (marsh == null) { igniteCfg.setMarshaller(new BinaryMarshaller()); dotNetCfg.warnings(Collections.singleton("Marshaller is automatically set to " + BinaryMarshaller.class.getName() + " (other nodes must have the same marshaller type).")); } else if (!(marsh instanceof BinaryMarshaller)) throw new IgniteException("Unsupported marshaller (only " + BinaryMarshaller.class.getName() + " can be used when running Apache Ignite.NET): " + marsh.getClass().getName()); BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration(); }
/** * Configure marshaller with custom Ignite Binary Object configuration. */ public void setBinaryConfiguration(BinaryConfiguration binCfg) { if (impl.context().configuration().getBinaryConfiguration() != binCfg) impl = createImpl(binCfg); }
/** * @param clsName Type name. * @return Instance of ID mapper. */ BinaryInternalMapper userTypeMapper(String clsName) { BinaryInternalMapper mapper = cls2Mappers.get(clsName); if (mapper != null) return mapper; mapper = resolveMapper(clsName, igniteCfg.getBinaryConfiguration()); BinaryInternalMapper prevMap = cls2Mappers.putIfAbsent(clsName, mapper); if (prevMap != null && !mapper.equals(prevMap)) throw new IgniteException("Different mappers [clsName=" + clsName + ", newMapper=" + mapper + ", prevMap=" + prevMap + "]"); prevMap = typeId2Mapper.putIfAbsent(mapper.typeId(clsName), mapper); if (prevMap != null && !mapper.equals(prevMap)) throw new IgniteException("Different mappers [clsName=" + clsName + ", newMapper=" + mapper + ", prevMap=" + prevMap + "]"); return mapper; }
/** * @param clsName Class name. * @return Type name. */ private String expectedTypeName(String clsName) { BinaryNameMapper mapper = cfg.getBinaryConfiguration().getNameMapper(); if (mapper == null) mapper = BinaryContext.defaultNameMapper(); return mapper.typeName(clsName); }
/** * @param clsName Class name. * @return Type name. */ private String expectedTypeName(String clsName) { BinaryNameMapper nameMapper = cfg.getBinaryConfiguration().getNameMapper(); if (nameMapper == null) nameMapper = BinaryContext.defaultNameMapper(); return nameMapper.typeName(clsName); }
/** * @param fullClsName Class name. * @return Expected type name according to configuration. */ private String expectedTypeName(String fullClsName) { BinaryNameMapper mapper = cfg.getBinaryConfiguration().getNameMapper(); if (mapper == null) mapper = BinaryContext.defaultNameMapper(); return mapper.typeName(fullClsName); }
/** * @return Expected hash code. * @param fullName Full name of type. */ private int expectedHashCode(String fullName) { BinaryIdMapper idMapper = cfg.getBinaryConfiguration().getIdMapper(); BinaryNameMapper nameMapper = cfg.getBinaryConfiguration().getNameMapper(); if (idMapper == null) idMapper = BinaryContext.defaultIdMapper(); if (nameMapper == null) nameMapper = BinaryContext.defaultNameMapper(); return idMapper.typeId(nameMapper.typeName(fullName)); }
/** * @throws Exception If failed. */ @SuppressWarnings("unchecked") @Test public void testCircularReference() throws Exception { IgniteCache c = keepBinaryCache(); TestReferenceObject obj1 = new TestReferenceObject(); obj1.obj = new TestReferenceObject(obj1); c.put(1, obj1); BinaryObject po = (BinaryObject)c.get(1); String str = po.toString(); log.info("toString: " + str); assertNotNull(str); BinaryNameMapper nameMapper = BinaryContext.defaultNameMapper(); if (cfg.getBinaryConfiguration() != null && cfg.getBinaryConfiguration().getNameMapper() != null) nameMapper = cfg.getBinaryConfiguration().getNameMapper(); String typeName = nameMapper.typeName(TestReferenceObject.class.getName()); assertTrue("Unexpected toString: " + str, S.INCLUDE_SENSITIVE ? str.startsWith(typeName) && str.contains("obj=" + typeName + " [") : str.startsWith("BinaryObject") && str.contains("idHash=") && str.contains("hash=") ); TestReferenceObject obj1_r = po.deserialize(); assertNotNull(obj1_r); TestReferenceObject obj2_r = obj1_r.obj; assertNotNull(obj2_r); assertSame(obj1_r, obj2_r.obj); }
BinaryConfiguration bCfg = ctx.config().getBinaryConfiguration();
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryConfiguration bCfg = cfg.getBinaryConfiguration(); bCfg.setIdMapper(new BinaryBasicIdMapper(true)); bCfg.setNameMapper(new BinaryBasicNameMapper(true)); return cfg; } }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryConfiguration bCfg = cfg.getBinaryConfiguration(); bCfg.setNameMapper(new BinaryBasicNameMapper()); bCfg.setIdMapper(new BinaryBasicIdMapper(true)); return cfg; } }
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); BinaryConfiguration bCfg = cfg.getBinaryConfiguration(); bCfg.setNameMapper(new BinaryBasicNameMapper()); bCfg.setIdMapper(new BinaryBasicIdMapper(true)); return cfg; } }
" can be used when running Apache Ignite C++): " + marsh.getClass().getName()); BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
BinaryConfiguration bCfg = cfg.getBinaryConfiguration(); BinaryConfiguration bCfg = cfg.getBinaryConfiguration();
/** * @param marsh Binary marshaller. * @param cfg Configuration. * @throws BinaryObjectException In case of error. */ public void configure(BinaryMarshaller marsh, IgniteConfiguration cfg) throws BinaryObjectException { if (marsh == null) return; this.marsh = marsh; marshCtx = marsh.getContext(); BinaryConfiguration binaryCfg = cfg.getBinaryConfiguration(); if (binaryCfg == null) binaryCfg = new BinaryConfiguration(); assert marshCtx != null; optmMarsh.setContext(marshCtx); configure( binaryCfg.getNameMapper(), binaryCfg.getIdMapper(), binaryCfg.getSerializer(), binaryCfg.getTypeConfigurations() ); compactFooter = binaryCfg.isCompactFooter(); }
+ ", marshaller=" + nodeCfg.getMarshaller() + ", discovery=" + nodeCfg.getDiscoverySpi() + ", binaryCfg=" + nodeCfg.getBinaryConfiguration() + ", lateAff=" + nodeCfg.isLateAffinityAssignment() + "]");
add(ATTR_MARSHALLER_COMPACT_FOOTER, cfg.getBinaryConfiguration() == null ? BinaryConfiguration.DFLT_COMPACT_FOOTER : cfg.getBinaryConfiguration().isCompactFooter());
warmupClos = compactClass(c.getWarmupClosure()); BinaryConfiguration bc = c.getBinaryConfiguration();
authEnabled = cfg.isAuthenticationEnabled(); autoActivation = cfg.isAutoActivationEnabled(); binaryCfg = cfg.getBinaryConfiguration(); dsCfg = cfg.getDataStorageConfiguration(); memCfg = cfg.getMemoryConfiguration();