Search in sources :

Example 1 with PlatformMemoryManagerImpl

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);
}
Also used : PlatformConfiguration(org.apache.ignite.configuration.PlatformConfiguration) PlatformDotNetConfiguration(org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration) IgniteException(org.apache.ignite.IgniteException) PlatformMemoryManagerImpl(org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl) PlatformLogger(org.apache.ignite.internal.logger.platform.PlatformLogger)

Example 2 with PlatformMemoryManagerImpl

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);
}
Also used : PlatformConfiguration(org.apache.ignite.configuration.PlatformConfiguration) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) Marshaller(org.apache.ignite.marshaller.Marshaller) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) BinaryBasicNameMapper(org.apache.ignite.binary.BinaryBasicNameMapper) BinaryBasicIdMapper(org.apache.ignite.binary.BinaryBasicIdMapper) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) PlatformCppConfiguration(org.apache.ignite.platform.cpp.PlatformCppConfiguration) IgniteException(org.apache.ignite.IgniteException) BinaryIdMapper(org.apache.ignite.binary.BinaryIdMapper) BinaryNameMapper(org.apache.ignite.binary.BinaryNameMapper) PlatformMemoryManagerImpl(org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl)

Aggregations

IgniteException (org.apache.ignite.IgniteException)2 PlatformConfiguration (org.apache.ignite.configuration.PlatformConfiguration)2 PlatformMemoryManagerImpl (org.apache.ignite.internal.processors.platform.memory.PlatformMemoryManagerImpl)2 BinaryBasicIdMapper (org.apache.ignite.binary.BinaryBasicIdMapper)1 BinaryBasicNameMapper (org.apache.ignite.binary.BinaryBasicNameMapper)1 BinaryIdMapper (org.apache.ignite.binary.BinaryIdMapper)1 BinaryNameMapper (org.apache.ignite.binary.BinaryNameMapper)1 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)1 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)1 PlatformLogger (org.apache.ignite.internal.logger.platform.PlatformLogger)1 Marshaller (org.apache.ignite.marshaller.Marshaller)1 PlatformCppConfiguration (org.apache.ignite.platform.cpp.PlatformCppConfiguration)1 PlatformDotNetConfiguration (org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration)1