本文整理汇总了Java中org.apache.ignite.configuration.IgniteConfiguration.setTransactionConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteConfiguration.setTransactionConfiguration方法的具体用法?Java IgniteConfiguration.setTransactionConfiguration怎么用?Java IgniteConfiguration.setTransactionConfiguration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.IgniteConfiguration
的用法示例。
在下文中一共展示了IgniteConfiguration.setTransactionConfiguration方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
// DiscoverySpi.
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
// Cache.
cfg.setCacheConfiguration(cacheConfiguration());
TransactionConfiguration tCfg = new TransactionConfiguration();
tCfg.setDefaultTxConcurrency(PESSIMISTIC);
tCfg.setDefaultTxIsolation(REPEATABLE_READ);
cfg.setTransactionConfiguration(tCfg);
return cfg;
}
示例2: createConfig
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
private IgniteConfiguration createConfig() {
IgniteConfiguration config = new IgniteConfiguration();
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();
transactionConfiguration.setDefaultTxConcurrency( TransactionConcurrency.OPTIMISTIC );
transactionConfiguration.setDefaultTxIsolation( TransactionIsolation.READ_COMMITTED );
config.setTransactionConfiguration( transactionConfiguration );
return config;
}
示例3: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@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;
}
示例4: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
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;
}
示例5: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@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);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例6: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
TransactionConfiguration txCfg = new TransactionConfiguration();
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;
}
示例7: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings({"unchecked"})
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TransactionConfiguration tCfg = new TransactionConfiguration();
tCfg.setTxSerializableEnabled(true);
c.setTransactionConfiguration(tCfg);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(REPLICATED);
cc.setEvictionPolicy(null);
cc.setWriteSynchronizationMode(FULL_SYNC);
c.setCacheConfiguration(cc);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
c.setDiscoverySpi(spi);
if (CACHE_DEBUG)
resetLog4j(Level.DEBUG, LOG_TO_FILE, GridCacheProcessor.class.getPackage().getName());
return c;
}
示例8: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@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;
}
示例9: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TransactionConfiguration tCfg = new TransactionConfiguration();
tCfg.setTxSerializableEnabled(true);
cfg.setTransactionConfiguration(tCfg);
return cfg;
}
示例10: systemInitialize
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/**
* <code>systemInitialize</code> is the entry method to start all the operations within iotracah.
* This class is expected to be extended by the core plugin only.
* If there is more than that implementation then the first implementation with no
* guarantee of selection will be loaded.
* The system will automatically throw a <code>UnRetriableException</code> if no implementation of this
* interface is detected.
*
* @param baseSystemHandlerList
* @throws UnRetriableException
*/
@Override
public void systemInitialize(List<BaseSystemHandler> baseSystemHandlerList) throws UnRetriableException {
//Initiate ignite.
synchronized (this) {
TcpDiscoverySpi spi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
// Set initial IP addresses.
// Note that you can optionally specify a port or a port range.
ipFinder.setAddresses(Arrays.asList(getDiscoveryAddresses()));
spi.setIpFinder(ipFinder);
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setGridName(getExecutorDefaultName());
// Override default discovery SPI.
cfg.setDiscoverySpi(spi);
//Set node attribute.
Map<String, String> attributes = new HashMap<>();
attributes.put("ROLE", getExecutorDefaultName());
cfg.setUserAttributes(attributes);
//Use sl4j logger
IgniteLogger gridLog = new Slf4jLogger(LoggerFactory.getLogger("org.apache.ignite")); // Provide correct SLF4J logger here.
cfg.setGridLogger(gridLog);
//Optimize marshaller
OptimizedMarshaller optimizedMarshaller = new OptimizedMarshaller();
optimizedMarshaller.setRequireSerializable(true);
cfg.setMarshaller(optimizedMarshaller);
TransactionConfiguration transactionConfiguration = new TransactionConfiguration();
transactionConfiguration.setDefaultTxConcurrency(TransactionConcurrency.PESSIMISTIC);
transactionConfiguration.setDefaultTxIsolation(TransactionIsolation.READ_COMMITTED);
transactionConfiguration.setDefaultTxTimeout(30000);
cfg.setTransactionConfiguration(transactionConfiguration);
cfg.setMetricsLogFrequency(0);
cfg.setMetricsUpdateFrequency(15000);
Ignition.start(cfg);
//Also instantiate the server router.
IgniteMessaging igniteMessaging = getIgnite().message();
String cluster = getExecutorDefaultName();
UUID nodeId = getNodeId();
DefaultServerRouter defaultServerRouter = new DefaultServerRouter(cluster, nodeId, igniteMessaging);
defaultServerRouter.initiate();
this.serverRouter = defaultServerRouter;
}
log.debug(" systemInitialize : performing classifications for base system handlers");
baseSystemHandlerList.forEach(this::classifyBaseHandler);
}
示例11: getConfiguration
import org.apache.ignite.configuration.IgniteConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
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 * 1024 * 1024);
memPlcCfg.setMaxSize(PAGE_CACHE_SIZE * 1024 * 1024);
memPlcCfg.setPersistenceEnabled(true);
DataStorageConfiguration memCfg = new DataStorageConfiguration();
memCfg.setDefaultDataRegionConfiguration(memPlcCfg);
memCfg.setWalHistorySize(1);
memCfg.setCheckpointFrequency(CHECKPOINT_FREQUENCY);
memCfg.setPageSize(PAGE_SIZE * 1024);
cfg.setDataStorageConfiguration(memCfg);
return cfg;
}