Java Code Examples for org.apache.ignite.configuration.CacheConfiguration#setAtomicityMode()
The following examples show how to use
org.apache.ignite.configuration.CacheConfiguration#setAtomicityMode() .
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: GridIndexingWithNoopSwapSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration<?,?> cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cc.setRebalanceMode(SYNC); cc.setNearConfiguration(new NearCacheConfiguration()); FifoEvictionPolicy plc = new FifoEvictionPolicy(); plc.setMaxSize(1000); cc.setEvictionPolicy(plc); cc.setOnheapCacheEnabled(true); cc.setBackups(1); cc.setAtomicityMode(TRANSACTIONAL); cc.setIndexedTypes( Integer.class, ObjectValue.class ); c.setCacheConfiguration(cc); return c; }
Example 2
Source File: IgniteCachePartitionedQueryMultiThreadedSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); // Query should be executed without ongoing transactions. cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cc.setBackups(0); cc.setRebalanceMode(CacheRebalanceMode.SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setIndexedTypes( UUID.class, PersonObj.class ); c.setCacheConfiguration(cc); return c; }
Example 3
Source File: CacheMvccProcessorLazyStartTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testPreconfiguredCacheMvccNotStarted() throws Exception { CacheConfiguration ccfg = cacheConfiguration(CacheMode.PARTITIONED, CacheWriteSynchronizationMode.FULL_SYNC, 0, 1); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); IgniteConfiguration cfg = getConfiguration(); cfg.setCacheConfiguration(ccfg); IgniteConfiguration cfg2 = getConfiguration("node2"); IgniteEx node1 = startGrid(cfg); IgniteEx node2 = startGrid(cfg2); IgniteCache cache = node1.cache(ccfg.getName()); cache.put(1, 1); cache.put(1, 2); assertFalse(mvccEnabled(node1)); assertFalse(mvccEnabled(node2)); }
Example 4
Source File: IgniteCacheQueryMultiThreadedSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @return Cache configuration. */ protected CacheConfiguration cacheConfiguration() { CacheConfiguration<?,?> cacheCfg = defaultCacheConfiguration(); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setBackups(1); LruEvictionPolicy plc = null; if (evictsEnabled()) { plc = new LruEvictionPolicy(); plc.setMaxSize(100); } cacheCfg.setEvictionPolicy(plc); cacheCfg.setOnheapCacheEnabled(plc != null); return cacheCfg; }
Example 5
Source File: HibernateL2CacheMultiJvmTest.java From ignite with Apache License 2.0 | 5 votes |
private CacheConfiguration cacheConfiguration(String cacheName) { CacheConfiguration cfg = new CacheConfiguration(); cfg.setName(cacheName); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(ATOMIC); cfg.setWriteSynchronizationMode(FULL_SYNC); return cfg; }
Example 6
Source File: GridCacheDhtPreloadStartStopSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration[] cacheCfgs = new CacheConfiguration[cacheCnt]; for (int i = 0; i < cacheCnt; i++) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName("partitioned-" + i); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setRebalanceBatchSize(preloadBatchSize); cacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); cacheCfg.setRebalanceMode(preloadMode); cacheCfg.setAffinity(new RendezvousAffinityFunction(false, partitions)); cacheCfg.setBackups(backups); cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfgs[i] = cacheCfg; } cfg.setCacheConfiguration(cacheCfgs); cfg.setDeploymentMode(CONTINUOUS); return cfg; }
Example 7
Source File: IgniteHadoopFileSystemIpcCacheSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Gets cache configuration. * * @return Cache configuration. */ private CacheConfiguration metaCacheConfiguration() { CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setName("replicated"); ccfg.setCacheMode(REPLICATED); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setAtomicityMode(TRANSACTIONAL); return ccfg; }
Example 8
Source File: HibernateL2CacheStrategySelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param cacheName Cache name. * @return Cache configuration. */ private CacheConfiguration cacheConfiguration(String cacheName) { CacheConfiguration cfg = new CacheConfiguration(); cfg.setName(cacheName); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(TRANSACTIONAL); return cfg; }
Example 9
Source File: HadoopIgfs20FileSystemAbstractSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Gets cache configuration. * * @param gridName Grid name. * @return Cache configuration. */ protected CacheConfiguration metaCacheConfiguration(String gridName) { CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setCacheMode(REPLICATED); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setAtomicityMode(TRANSACTIONAL); return ccfg; }
Example 10
Source File: CacheOperationsWithExpirationTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @param atomicityMode Atomicity mode. * @param idx Indexing enabled flag. * @return Cache configuration. */ private CacheConfiguration<String, TestIndexedType> cacheConfiguration(CacheAtomicityMode atomicityMode, boolean idx) { CacheConfiguration<String, TestIndexedType> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); ccfg.setAtomicityMode(atomicityMode); ccfg.setBackups(1); ccfg.setWriteSynchronizationMode(PRIMARY_SYNC); ccfg.setStatisticsEnabled(true); if (idx) ccfg.setIndexedTypes(String.class, TestIndexedType.class); return ccfg; }
Example 11
Source File: GridCacheAbstractReplicatedByteArrayValuesSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected CacheConfiguration cacheConfiguration0() { CacheConfiguration cfg = new CacheConfiguration(); cfg.setCacheMode(REPLICATED); cfg.setAtomicityMode(TRANSACTIONAL); cfg.setWriteSynchronizationMode(FULL_SYNC); return cfg; }
Example 12
Source File: GridCacheOffheapIndexGetSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @return Cache configuration. */ protected CacheConfiguration cacheConfiguration() { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); cacheCfg.setCacheMode(PARTITIONED); cacheCfg.setBackups(1); cacheCfg.setAtomicityMode(TRANSACTIONAL); cacheCfg.setEvictionPolicy(null); return cacheCfg; }
Example 13
Source File: CacheStopAndDestroySelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @return near config */ private CacheConfiguration getNearConfig() { CacheConfiguration cfg = defaultCacheConfiguration(); cfg.setName(CACHE_NAME_NEAR); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); cfg.setNearConfiguration(new NearCacheConfiguration()); return cfg; }
Example 14
Source File: CacheGetEntryAbstractTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @throws Exception If failed. */ @Test public void testNearTransactional() throws Exception { CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME); cfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheMode(PARTITIONED); cfg.setAtomicityMode(TRANSACTIONAL); cfg.setName("nearT"); cfg.setNearConfiguration(new NearCacheConfiguration()); test(cfg); }
Example 15
Source File: CacheMvccClusterRestartTest.java From ignite with Apache License 2.0 | 5 votes |
/** * @return Cache configuration. */ private CacheConfiguration<Object, Object> cacheConfiguration() { CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setAtomicityMode(TRANSACTIONAL_SNAPSHOT); ccfg.setBackups(2); return ccfg; }
Example 16
Source File: GridCacheReturnValueTransferSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setBackups(backups); ccfg.setCacheMode(PARTITIONED); ccfg.setAtomicityMode(atomicityMode); cfg.setCacheConfiguration(ccfg); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); return cfg; }
Example 17
Source File: GridCacheDaemonNodeAbstractSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); c.setDaemon(daemon); c.setConnectorConfiguration(null); CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(cacheMode()); cc.setAtomicityMode(TRANSACTIONAL); cc.setNearConfiguration(new NearCacheConfiguration()); c.setCacheConfiguration(cc); return c; }
Example 18
Source File: CacheLoadingConcurrentGridStartSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setAtomicityMode(atomicityMode()); ccfg.setCacheMode(PARTITIONED); ccfg.setBackups(1); ccfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestCacheStoreAdapter())); ccfg.setAffinity(new RendezvousAffinityFunction(false, 64)); if (getTestIgniteInstanceName(0).equals(igniteInstanceName)) { if (client) cfg.setClientMode(true); if (configured) cfg.setCacheConfiguration(ccfg); } else cfg.setCacheConfiguration(ccfg); if (!configured) { ccfg.setNodeFilter(new P1<ClusterNode>() { @Override public boolean apply(ClusterNode node) { String name = node.attribute(ATTR_IGNITE_INSTANCE_NAME).toString(); return !getTestIgniteInstanceName(0).equals(name); } }); } return cfg; }
Example 19
Source File: GridCachePartitionedMultiThreadedPutGetSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); c.getTransactionConfiguration().setTxSerializableEnabled(true); CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setBackups(1); cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); FifoEvictionPolicy plc = new FifoEvictionPolicy(); plc.setMaxMemorySize(1000); cc.setEvictionPolicy(plc); cc.setOnheapCacheEnabled(true); cc.setAtomicityMode(TRANSACTIONAL); NearCacheConfiguration nearCfg = new NearCacheConfiguration(); nearCfg.setNearEvictionPolicy(new GridCacheAlwaysEvictionPolicy()); cc.setNearConfiguration(nearCfg); c.setCacheConfiguration(cc); return c; }
Example 20
Source File: IgniteHadoopFileSystemLoggerStateSelfTest.java From ignite with Apache License 2.0 | 2 votes |
/** * Startup the grid and instantiate the file system. * * @throws Exception If failed. */ private void startUp() throws Exception { FileSystemConfiguration igfsCfg = new FileSystemConfiguration(); igfsCfg.setName("igfs"); igfsCfg.setBlockSize(512 * 1024); igfsCfg.setDefaultMode(PRIMARY); IgfsIpcEndpointConfiguration endpointCfg = new IgfsIpcEndpointConfiguration(); endpointCfg.setType(IgfsIpcEndpointType.TCP); endpointCfg.setPort(10500); igfsCfg.setIpcEndpointConfiguration(endpointCfg); CacheConfiguration dataCacheCfg = defaultCacheConfiguration(); dataCacheCfg.setName("partitioned"); dataCacheCfg.setCacheMode(PARTITIONED); dataCacheCfg.setNearConfiguration(null); dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128)); dataCacheCfg.setBackups(0); dataCacheCfg.setAtomicityMode(TRANSACTIONAL); CacheConfiguration metaCacheCfg = defaultCacheConfiguration(); metaCacheCfg.setName("replicated"); metaCacheCfg.setCacheMode(REPLICATED); metaCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); metaCacheCfg.setAtomicityMode(TRANSACTIONAL); igfsCfg.setDataCacheConfiguration(dataCacheCfg); igfsCfg.setMetaCacheConfiguration(metaCacheCfg); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setIgniteInstanceName("igfs-grid"); TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true)); cfg.setDiscoverySpi(discoSpi); cfg.setFileSystemConfiguration(igfsCfg); cfg.setLocalHost("127.0.0.1"); cfg.setConnectorConfiguration(null); Ignite g = G.start(cfg); igfs = (IgfsEx)g.fileSystem("igfs"); igfs.globalSampling(sampling); fs = fileSystem(); }