Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setFailureHandler()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setFailureHandler() .
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: IgnitePdsTaskCancelingTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setFailureHandler(new AbstractFailureHandler() { @Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { failure.set(true); return true; } }); cfg.setCacheConfiguration(new CacheConfiguration().setName(DEFAULT_CACHE_NAME).setAffinity( new RendezvousAffinityFunction(false, NUM_TASKS / 2) )); cfg.setDataStorageConfiguration(getDataStorageConfiguration()); // Set the thread pool size according to the NUM_TASKS. cfg.setPublicThreadPoolSize(16); return cfg; }
Example 2
Source File: IgniteRebalanceOnCachesStoppingOrDestroyingTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@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 3
Source File: TxRecoveryStoreEnabledTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setCommunicationSpi(new TestCommunicationSpi()); CacheConfiguration ccfg = defaultCacheConfiguration(); ccfg.setName(CACHE_NAME); ccfg.setNearConfiguration(null); ccfg.setCacheMode(CacheMode.PARTITIONED); ccfg.setBackups(1); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); ccfg.setCacheStoreFactory(new TestCacheStoreFactory()); ccfg.setReadThrough(true); ccfg.setWriteThrough(true); ccfg.setWriteBehindEnabled(false); cfg.setCacheConfiguration(ccfg); cfg.setFailureHandler(new StopNodeFailureHandler()); return cfg; }
Example 4
Source File: IgniteWalFormatFileFailoverTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setCacheConfiguration(new CacheConfiguration(TEST_CACHE) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setMaxSize(2048L * 1024 * 1024) .setPersistenceEnabled(true)) .setWalMode(fsync ? WALMode.FSYNC : WALMode.BACKGROUND) .setWalBufferSize(1024 * 1024) .setWalSegmentSize(512 * 1024) .setFileIOFactory(new FailingFileIOFactory(failMtdNameRef)); cfg.setDataStorageConfiguration(memCfg); cfg.setFailureHandler(new TestFailureHandler(false)); return cfg; }
Example 5
Source File: SystemWorkersTerminationTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setFailureHandler(new TestFailureHandler()); DataRegionConfiguration drCfg = new DataRegionConfiguration(); drCfg.setPersistenceEnabled(true); DataStorageConfiguration dsCfg = new DataStorageConfiguration(); dsCfg.setDefaultDataRegionConfiguration(drCfg); dsCfg.setWalCompactionEnabled(true); cfg.setDataStorageConfiguration(dsCfg); return cfg; }
Example 6
Source File: CacheDataRegionConfigurationTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (nonNull(logger)) cfg.setGridLogger(logger); if (nonNull(failureHnd)) cfg.setFailureHandler(failureHnd); if (gridName.contains("client")) { cfg.setClientMode(true); return cfg; } if (nonNull(memCfg)) cfg.setDataStorageConfiguration(memCfg); if (nonNull(ccfg)) cfg.setCacheConfiguration(ccfg); return cfg; }
Example 7
Source File: EvictionPolicyFailureHandlerTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setFailureHandler((ignite, failureCtx) -> { nodeFailure.set(true); return false; }); SortedEvictionPolicyFactory plcFactory = new SortedEvictionPolicyFactory(); plcFactory.setMaxSize(3); plcFactory.setBatchSize(10); plcFactory.setMaxMemorySize(10); cfg.setGridLogger(log); cfg.setCacheConfiguration(new CacheConfiguration<Integer, Integer>(DEFAULT_CACHE_NAME) .setEvictionPolicyFactory(oom ? (Factory<ThrowableEvictionPolicy>)ThrowableEvictionPolicy::new : plcFactory) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setOnheapCacheEnabled(true)); return cfg; }
Example 8
Source File: GridCacheDhtPreloadMultiThreadedSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = loadConfiguration("modules/core/src/test/config/spring-multicache.xml"); cfg.setGridLogger(getTestResources().getLogger()); cfg.setIgniteInstanceName(igniteInstanceName); cfg.setFailureHandler(new NoOpFailureHandler()); for (CacheConfiguration cCfg : cfg.getCacheConfiguration()) { if (cCfg.getCacheMode() == CacheMode.PARTITIONED) { cCfg.setAffinity(new RendezvousAffinityFunction(2048, null)); cCfg.setBackups(1); } } return cfg; }
Example 9
Source File: ConfigVariationsFactory.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override public IgniteConfiguration getConfiguration(String igniteInstanceName, IgniteConfiguration srcCfg) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setFailureHandler(new NoOpFailureHandler()); if (srcCfg != null) copyDefaultsFromSource(cfg, srcCfg); if (igniteParams == null) return cfg; for (int i = 0; i < igniteCfgVariation.length; i++) { int var = igniteCfgVariation[i]; ConfigParameter<IgniteConfiguration> cfgC = igniteParams[i][var]; if (cfgC != null) cfgC.apply(cfg); } return cfg; }
Example 10
Source File: IgnitePdsCacheObjectBinaryProcessorOnDiscoveryTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if ("client".equals(igniteInstanceName)) cfg.setFailureHandler(new StopNodeFailureHandler()); return cfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setPersistenceEnabled(true))); }
Example 11
Source File: CheckpointFailBeforeWriteMarkTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setConsistentId(igniteInstanceName); DataStorageConfiguration storageCfg = new DataStorageConfiguration(); //By some reasons in the compression case it is required more memory for reproducing. boolean isCompression = System.getProperty(IGNITE_DEFAULT_DISK_PAGE_COMPRESSION) != null; storageCfg.setCheckpointThreads(2) .setFileIOFactory(interceptorIOFactory) .setWalSegmentSize((isCompression ? 20 : 5) * 1024 * 1024) .setWalSegments(3); storageCfg.getDefaultDataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize((isCompression ? 70 : 10) * 1024 * 1024); cfg.setDataStorageConfiguration(storageCfg) .setCacheConfiguration(new CacheConfiguration<>(DEFAULT_CACHE_NAME) .setAffinity(new RendezvousAffinityFunction(false, 16))); cfg.setFailureHandler(new StopNodeFailureHandler()); return cfg; }
Example 12
Source File: IgniteShutdownOnSupplyMessageFailureTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String name) throws Exception { IgniteConfiguration cfg = super.getConfiguration(name); cfg.setConsistentId(name); DataStorageConfiguration conf = new DataStorageConfiguration() .setWalHistorySize(WAL_HISTORY_SIZE) .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(DataStorageConfiguration.DFLT_DATA_REGION_INITIAL_SIZE) .setPersistenceEnabled(true) ) .setWalMode(WALMode.FSYNC) .setCheckpointFrequency(500); if (name.equals(getTestIgniteInstanceName(NODE_NAME_WITH_TEST_FILE_FACTORY))) { conf.setFileIOFactory(new FailingFileIOFactory(canFailFirstNode)); cfg.setFailureHandler(new TestFailureHandler()); } else cfg.setFailureHandler(new StopNodeFailureHandler()); cfg.setDataStorageConfiguration(conf); return cfg; }
Example 13
Source File: TcpDiscoverySegmentationPolicyTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (igniteInstanceName.endsWith("2")) cfg.setFailureHandler(new TestFailureHandler()); // Disable recovery ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setConnectionRecoveryTimeout(0); return cfg; }
Example 14
Source File: IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setConsistentId(gridName); cfg.setCacheConfiguration( new CacheConfiguration(DEFAULT_CACHE_NAME) .setAtomicityMode(TRANSACTIONAL) .setBackups(1) .setRebalanceMode(SYNC) .setAffinity(new RendezvousAffinityFunction(false, 32)) ); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(2048L * 1024 * 1024) .setPersistenceEnabled(true)) .setWalMode(walMode()) .setWalSegmentSize(512 * 1024) .setWalBufferSize(512 * 1024)); cfg.setFailureHandler(new StopNodeFailureHandler()); return cfg; }
Example 15
Source File: IgnitePdsWithTtlTest2.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(100L * 1024 * 1024) .setPersistenceEnabled(true) )); cfg.setCacheConfiguration( getCacheConfiguration("cache_1"), getCacheConfiguration("cache_2"), getCacheConfiguration("cache_3"), getCacheConfiguration("cache_4"), getCacheConfiguration("cache_5"), getCacheConfiguration("cache_6"), getCacheConfiguration("cache_7"), getCacheConfiguration("cache_8"), getCacheConfiguration("cache_9"), getCacheConfiguration("cache_10"), getCacheConfiguration("cache_11"), getCacheConfiguration("cache_12"), getCacheConfiguration("cache_13"), getCacheConfiguration("cache_14"), getCacheConfiguration("cache_15"), getCacheConfiguration("cache_16"), getCacheConfiguration("cache_17"), getCacheConfiguration("cache_18"), getCacheConfiguration("cache_19"), getCacheConfiguration("cache_20") ); cfg.setFailureHandler(new CustomStopNodeOrHaltFailureHandler()); return cfg; }
Example 16
Source File: CacheGetReadFromBackupFailoverTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setFailureHandler(new AbstractFailureHandler() { @Override protected boolean handle(Ignite ignite, FailureContext failureCtx) { err.compareAndSet(null, failureCtx.error()); stop.set(true); return false; } }); cfg.setConsistentId(igniteInstanceName); CacheConfiguration<Long, Long> txCcfg = new CacheConfiguration<Long, Long>(TX_CACHE) .setAtomicityMode(TRANSACTIONAL) .setCacheMode(PARTITIONED) .setBackups(1) .setWriteSynchronizationMode(FULL_SYNC) .setReadFromBackup(true); CacheConfiguration<Long, Long> atomicCcfg = new CacheConfiguration<Long, Long>(ATOMIC_CACHE) .setAtomicityMode(ATOMIC) .setCacheMode(PARTITIONED) .setBackups(1) .setWriteSynchronizationMode(FULL_SYNC) .setReadFromBackup(true); cfg.setCacheConfiguration(txCcfg, atomicCcfg); // Enforce different mac adresses to emulate distributed environment by default. cfg.setUserAttributes(Collections.singletonMap( IgniteNodeAttributes.ATTR_MACS_OVERRIDE, UUID.randomUUID().toString())); return cfg; }
Example 17
Source File: IgniteCacheExpireWhileRebalanceTest.java From ignite with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER); cfg.setFailureHandler(new StopNodeOrHaltFailureHandler()); CacheConfiguration<Object, Object> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME); ccfg.setAtomicityMode(ATOMIC); ccfg.setCacheMode(PARTITIONED); ccfg.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(new Duration(TimeUnit.SECONDS, 1))); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 18
Source File: FailureProcessorThreadDumpThrottlingTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); TestFailureHandler hnd = new TestFailureHandler(false); hnd.setIgnoredFailureTypes(ImmutableSet.of(FailureType.SYSTEM_CRITICAL_OPERATION_TIMEOUT, SYSTEM_WORKER_BLOCKED)); cfg.setFailureHandler(hnd); cfg.setGridLogger(testLog); return cfg; }
Example 19
Source File: ClusterReadOnlyModeAbstractTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(ClusterReadOnlyModeTestUtils.cacheConfigurations()); cfg.setFailureHandler(new StopNodeOrHaltFailureHandler()); return cfg; }
Example 20
Source File: CacheScanQueryFailoverTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String name) throws Exception { IgniteConfiguration cfg = super.getConfiguration(name); cfg.setConsistentId(name); cfg.setFailureHandler(new StopNodeOrHaltFailureHandler()); return cfg; }