/** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);

    OptimizedMarshaller marsh = new OptimizedMarshaller();
    marsh.setRequireSerializable(false);

    cfg.setMarshaller(marsh);

    CacheConfiguration ccfg = defaultCacheConfiguration();
    ccfg.setCacheMode(CacheMode.PARTITIONED);
    ccfg.setBackups(1);
    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    ccfg.setWriteSynchronizationMode(PRIMARY_SYNC);
    ccfg.setNearConfiguration(null);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
  }
Beispiel #2
0
  /**
   * @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.getIdMapper(), binaryCfg.getSerializer(), binaryCfg.getTypeConfigurations());

    compactFooter = binaryCfg.isCompactFooter();
  }