Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setTransactionConfiguration()

The following examples show how to use org.apache.ignite.configuration.IgniteConfiguration#setTransactionConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IgniteTestConfigurationBuilder.java    From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 6 votes vote down vote up
private IgniteConfiguration createConfig() {
	IgniteConfiguration config = new IgniteConfiguration();
	config.setIgniteInstanceName( "OgmTestGrid" );
	config.setClientMode( false );
	BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
	binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
	binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection)
	config.setBinaryConfiguration( binaryConfiguration );
	TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
	// I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests
	// can highlight the issue. Ideally, we would want to test the different concurrency and isolation level.
	transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC );
	transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
	config.setTransactionConfiguration( transactionConfiguration );

	return config;
}
 
Example 2
Source File: IgniteModuleMemberRegistrationIT.java    From hibernate-ogm-ignite with GNU Lesser General Public License v2.1 6 votes vote down vote up
private IgniteConfiguration createConfig() {
	IgniteConfiguration config = new IgniteConfiguration();
	config.setIgniteInstanceName( "OgmTestGrid" );
	config.setClientMode( false );
	BinaryConfiguration binaryConfiguration = new BinaryConfiguration();
	binaryConfiguration.setNameMapper( new BinaryBasicNameMapper( true ) );
	binaryConfiguration.setCompactFooter( false ); // it is necessary only for embedded collections (@ElementCollection)
	config.setBinaryConfiguration( binaryConfiguration );
	TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
	// I'm going to use PESSIMISTIC here because some people had problem with it and it would be nice if tests
	// can highlight the issue. Ideally, we would want to test the different concurrency and isolation level.
	transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.PESSIMISTIC );
	transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
	config.setTransactionConfiguration( transactionConfiguration );

	return config;
}
 
Example 3
Source File: IgniteRebalanceOnCachesStoppingOrDestroyingTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setCommunicationSpi(new RebalanceBlockingSPI());

    cfg.setFailureHandler(new StopNodeFailureHandler());

    cfg.setRebalanceThreadPoolSize(4);

    cfg.setTransactionConfiguration(new TransactionConfiguration()
        .setDefaultTxTimeout(1000));

    cfg.setDataStorageConfiguration(
        new DataStorageConfiguration()
            .setWalMode(WALMode.LOG_ONLY)
            .setDefaultDataRegionConfiguration(
                new DataRegionConfiguration()
                    .setPersistenceEnabled(true)
                    .setMaxSize(100L * 1024 * 1024)));

    return cfg;
}
 
Example 4
Source File: DdlTransactionSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setTransactionConfiguration(new TransactionConfiguration()
        .setDefaultTxIsolation(TransactionIsolation.REPEATABLE_READ)
        .setDefaultTxConcurrency(TransactionConcurrency.PESSIMISTIC)
        .setDefaultTxTimeout(5000));

    cfg.setCacheConfiguration(getCacheConfiguration());

    return cfg;
}
 
Example 5
Source File: CacheGetsDistributionAbstractTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TransactionConfiguration txCfg = new TransactionConfiguration()
        .setDefaultTxIsolation(transactionIsolation())
        .setDefaultTxConcurrency(transactionConcurrency());

    cfg.setTransactionConfiguration(txCfg);

    return cfg;
}
 
Example 6
Source File: IgniteCacheContainsKeyAbstractSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TcpCommunicationSpi commSpi = new TcpCommunicationSpi();

    cfg.setCommunicationSpi(commSpi);

    TransactionConfiguration tcfg = new TransactionConfiguration();

    tcfg.setTxSerializableEnabled(true);

    cfg.setTransactionConfiguration(tcfg);

    return cfg;
}
 
Example 7
Source File: TxRollbackOnTopologyChangeTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    cfg.setTransactionConfiguration(new TransactionConfiguration().
        setTxTimeoutOnPartitionMapExchange(ROLLBACK_TIMEOUT));

    cfg.setCommunicationSpi(new TestRecordingCommunicationSpi());

    CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);

    ccfg.setAtomicityMode(TRANSACTIONAL);
    ccfg.setBackups(2);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
Example 8
Source File: IgniteTxConfigCacheSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TcpCommunicationSpi commSpi = new TestCommunicationSpi();

    cfg.setCommunicationSpi(commSpi);

    CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME);

    ccfg.setAtomicityMode(atomicityMode());
    ccfg.setBackups(1);

    cfg.setCacheConfiguration(ccfg);

    final TransactionConfiguration txCfg = new TransactionConfiguration();

    txCfg.setDefaultTxTimeout(TX_TIMEOUT);

    cfg.setTransactionConfiguration(txCfg);

    return cfg;
}
 
Example 9
Source File: GridCachePartitionedHitsAndMissesSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    // Cache.
    cfg.setCacheConfiguration(cacheConfiguration());

    TransactionConfiguration tCfg = new TransactionConfiguration();

    tCfg.setDefaultTxConcurrency(PESSIMISTIC);
    tCfg.setDefaultTxIsolation(REPEATABLE_READ);

    cfg.setTransactionConfiguration(tCfg);

    return cfg;
}
 
Example 10
Source File: GridCacheReplicatedTxMultiThreadedSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);

    TransactionConfiguration tCfg = new TransactionConfiguration();

    c.setTransactionConfiguration(tCfg);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(REPLICATED);

    cc.setEvictionPolicy(null);

    cc.setWriteSynchronizationMode(FULL_SYNC);

    c.setCacheConfiguration(cc);

    return c;
}
 
Example 11
Source File: CacheReadThroughRestartSelfTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    TransactionConfiguration txCfg = new TransactionConfiguration();

    txCfg.setTxSerializableEnabled(true);

    cfg.setTransactionConfiguration(txCfg);

    CacheConfiguration cc = cacheConfiguration(igniteInstanceName);

    cc.setLoadPreviousValue(false);

    cfg.setCacheConfiguration(cc);

    return cfg;
}
 
Example 12
Source File: CacheKeepBinaryTransactionTest.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    TransactionConfiguration txCfg = new TransactionConfiguration();

    if (!MvccFeatureChecker.forcedMvcc()) {
        txCfg.setDefaultTxConcurrency(TransactionConcurrency.OPTIMISTIC);
        txCfg.setDefaultTxIsolation(TransactionIsolation.REPEATABLE_READ);
    }

    cfg.setTransactionConfiguration(txCfg);

    cfg.setMarshaller(new BinaryMarshaller());

    CacheConfiguration ccfg = new CacheConfiguration("tx-cache");
    ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);

    cfg.setCacheConfiguration(ccfg);

    return cfg;
}
 
Example 13
Source File: IgnitePdsTransactionsHangTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);

    BinaryConfiguration binaryCfg = new BinaryConfiguration();
    binaryCfg.setCompactFooter(false);
    cfg.setBinaryConfiguration(binaryCfg);

    cfg.setPeerClassLoadingEnabled(true);

    TcpCommunicationSpi tcpCommSpi = new TcpCommunicationSpi();

    tcpCommSpi.setSharedMemoryPort(-1);
    cfg.setCommunicationSpi(tcpCommSpi);

    TransactionConfiguration txCfg = new TransactionConfiguration();

    txCfg.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);

    cfg.setTransactionConfiguration(txCfg);

    DataRegionConfiguration memPlcCfg = new DataRegionConfiguration();

    memPlcCfg.setName("dfltDataRegion");
    memPlcCfg.setInitialSize(PAGE_CACHE_SIZE);
    memPlcCfg.setMaxSize(PAGE_CACHE_SIZE);
    memPlcCfg.setPersistenceEnabled(true);

    DataStorageConfiguration memCfg = new DataStorageConfiguration();

    memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
    memCfg.setWalHistorySize(1);
    memCfg.setCheckpointFrequency(CHECKPOINT_FREQUENCY);
    memCfg.setPageSize(PAGE_SIZE);

    cfg.setDataStorageConfiguration(memCfg);

    return cfg;
}
 
Example 14
Source File: IgniteCacheTxIteratorSelfTest.java    From ignite with Apache License 2.0 3 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);

    final TransactionConfiguration txCfg = new TransactionConfiguration();

    txCfg.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);

    cfg.setTransactionConfiguration(txCfg);

    return cfg;
}