use of org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl in project ignite by apache.
the class PlatformDotNetConfigurationClosure method apply0.
/**
* {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
protected void apply0(IgniteConfiguration igniteCfg) {
// Validate and copy Interop configuration setting environment pointer along the way.
PlatformConfiguration interopCfg = igniteCfg.getPlatformConfiguration();
if (interopCfg != null && !(interopCfg instanceof PlatformDotNetConfiguration))
throw new IgniteException("Illegal platform configuration (must be of type " + PlatformDotNetConfiguration.class.getName() + "): " + interopCfg.getClass().getName());
PlatformDotNetConfiguration dotNetCfg = interopCfg != null ? (PlatformDotNetConfiguration) interopCfg : null;
if (dotNetCfg == null)
dotNetCfg = new PlatformDotNetConfiguration();
memMgr = new PlatformMemoryManagerImpl(gate, 1024);
PlatformLogger logger = null;
if (useLogger) {
logger = new PlatformLogger();
logger.setGateway(gate);
igniteCfg.setGridLogger(logger);
}
PlatformDotNetConfigurationEx dotNetCfg0 = new PlatformDotNetConfigurationEx(dotNetCfg, gate, memMgr, logger);
igniteCfg.setPlatformConfiguration(dotNetCfg0);
// Set Ignite home so that marshaller context works.
String ggHome = igniteCfg.getIgniteHome();
if (ggHome != null)
U.setIgniteHome(ggHome);
// Callback to .Net.
prepare(igniteCfg, dotNetCfg0);
// Make sure binary config is right.
setBinaryConfiguration(igniteCfg, dotNetCfg0);
}
use of org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl in project ignite by apache.
the class PlatformCppConfigurationClosure method apply0.
/**
* {@inheritDoc}
*/
@SuppressWarnings("deprecation")
@Override
protected void apply0(IgniteConfiguration igniteCfg) {
// 3. Validate and copy Interop configuration setting environment pointer along the way.
PlatformConfiguration interopCfg = igniteCfg.getPlatformConfiguration();
if (interopCfg != null && !(interopCfg instanceof PlatformCppConfiguration))
throw new IgniteException("Illegal interop configuration (must be of type " + PlatformCppConfiguration.class.getName() + "): " + interopCfg.getClass().getName());
PlatformCppConfiguration cppCfg = interopCfg != null ? (PlatformCppConfiguration) interopCfg : null;
if (cppCfg == null)
cppCfg = new PlatformCppConfiguration();
PlatformMemoryManagerImpl memMgr = new PlatformMemoryManagerImpl(gate, 1024);
PlatformCppConfigurationEx cppCfg0 = new PlatformCppConfigurationEx(cppCfg, gate, memMgr);
igniteCfg.setPlatformConfiguration(cppCfg0);
// Check marshaller
Marshaller marsh = igniteCfg.getMarshaller();
if (marsh == null) {
igniteCfg.setMarshaller(new BinaryMarshaller());
cppCfg0.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 C++): " + marsh.getClass().getName());
BinaryConfiguration bCfg = igniteCfg.getBinaryConfiguration();
if (bCfg == null) {
bCfg = new BinaryConfiguration();
bCfg.setCompactFooter(false);
bCfg.setNameMapper(new BinaryBasicNameMapper(true));
bCfg.setIdMapper(new BinaryBasicIdMapper(true));
igniteCfg.setBinaryConfiguration(bCfg);
cppCfg0.warnings(Collections.singleton("Binary configuration is automatically initiated, " + "note that binary name mapper is set to " + bCfg.getNameMapper() + " and binary ID mapper is set to " + bCfg.getIdMapper() + " (other nodes must have the same binary name and ID mapper types)."));
} else {
BinaryNameMapper nameMapper = bCfg.getNameMapper();
if (nameMapper == null) {
bCfg.setNameMapper(new BinaryBasicNameMapper(true));
cppCfg0.warnings(Collections.singleton("Binary name mapper is automatically set to " + bCfg.getNameMapper() + " (other nodes must have the same binary name mapper type)."));
}
BinaryIdMapper idMapper = bCfg.getIdMapper();
if (idMapper == null) {
bCfg.setIdMapper(new BinaryBasicIdMapper(true));
cppCfg0.warnings(Collections.singleton("Binary ID mapper is automatically set to " + bCfg.getIdMapper() + " (other nodes must have the same binary ID mapper type)."));
}
}
if (bCfg.isCompactFooter())
throw new IgniteException("Unsupported " + BinaryMarshaller.class.getName() + " \"compactFooter\" flag: must be false when running Apache Ignite C++.");
// Set Ignite home so that marshaller context works.
String ggHome = igniteCfg.getIgniteHome();
if (ggHome != null)
U.setIgniteHome(ggHome);
}
Aggregations