Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setEventStorageSpi()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setEventStorageSpi() .
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: GridFactorySelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @param igniteInstanceName Ignite instance name. * @throws Exception If test failed. */ private void checkLifecycleBeans(@Nullable String igniteInstanceName) throws Exception { TestLifecycleBean bean1 = new TestLifecycleBean(); TestLifecycleBean bean2 = new TestLifecycleBean(); IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setLifecycleBeans(bean1, bean2); cfg.setIgniteInstanceName(igniteInstanceName); cfg.setEventStorageSpi(new MemoryEventStorageSpi()); cfg.setConnectorConfiguration(null); try (Ignite g = IgniteSpring.start(cfg, new GenericApplicationContext())) { bean1.checkState(igniteInstanceName, true); bean2.checkState(igniteInstanceName, true); } bean1.checkState(igniteInstanceName, false); bean2.checkState(igniteInstanceName, false); checkLifecycleBean(bean1, igniteInstanceName); checkLifecycleBean(bean2, igniteInstanceName); }
Example 2
Source File: IgnitePageMemReplaceDelayedWriteUnitTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @param overallSize default region size in bytes * @return configuration for test. */ @NotNull private IgniteConfiguration getConfiguration(long overallSize) { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setEncryptionSpi(new NoopEncryptionSpi()); cfg.setMetricExporterSpi(new NoopMetricExporterSpi()); cfg.setEventStorageSpi(new NoopEventStorageSpi()); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(overallSize))); return cfg; }
Example 3
Source File: GridSpiExceptionSelfTest.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.setEventStorageSpi(new GridTestRuntimeExceptionSpi()); cfg.setDeploymentSpi(new GridTestCheckedExceptionSpi()); // Disable cache since it can deploy some classes during start process. cfg.setCacheConfiguration(); return cfg; }
Example 4
Source File: CacheContinuousQueryAsyncFilterListenerTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); MemoryEventStorageSpi storeSpi = new MemoryEventStorageSpi(); storeSpi.setExpireCount(1000); cfg.setEventStorageSpi(storeSpi); return cfg; }
Example 5
Source File: IgniteCacheEntryListenerAbstractTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); MemoryEventStorageSpi eventSpi = new MemoryEventStorageSpi(); eventSpi.setExpireCount(50); cfg.setEventStorageSpi(eventSpi); return cfg; }
Example 6
Source File: GridEventStorageDefaultExceptionTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(final String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setEventStorageSpi(new NoopEventStorageSpi()); return cfg; }
Example 7
Source File: IgnitionEx.java From ignite with Apache License 2.0 | 4 votes |
/** * Initialize default SPI implementations. * * @param cfg Ignite configuration. */ private void initializeDefaultSpi(IgniteConfiguration cfg) { if (cfg.getDiscoverySpi() == null) cfg.setDiscoverySpi(new TcpDiscoverySpi()); if (cfg.getDiscoverySpi() instanceof TcpDiscoverySpi) { TcpDiscoverySpi tcpDisco = (TcpDiscoverySpi)cfg.getDiscoverySpi(); if (tcpDisco.getIpFinder() == null) tcpDisco.setIpFinder(new TcpDiscoveryMulticastIpFinder()); } if (cfg.getCommunicationSpi() == null) cfg.setCommunicationSpi(new TcpCommunicationSpi()); if (cfg.getDeploymentSpi() == null) cfg.setDeploymentSpi(new LocalDeploymentSpi()); if (cfg.getEventStorageSpi() == null) cfg.setEventStorageSpi(new NoopEventStorageSpi()); if (cfg.getCheckpointSpi() == null) cfg.setCheckpointSpi(new NoopCheckpointSpi()); if (cfg.getCollisionSpi() == null) cfg.setCollisionSpi(new NoopCollisionSpi()); if (cfg.getFailoverSpi() == null) cfg.setFailoverSpi(new AlwaysFailoverSpi()); if (cfg.getLoadBalancingSpi() == null) cfg.setLoadBalancingSpi(new RoundRobinLoadBalancingSpi()); else { Collection<LoadBalancingSpi> spis = new ArrayList<>(); boolean dfltLoadBalancingSpi = false; for (LoadBalancingSpi spi : cfg.getLoadBalancingSpi()) { spis.add(spi); if (!dfltLoadBalancingSpi && spi instanceof RoundRobinLoadBalancingSpi) dfltLoadBalancingSpi = true; } // Add default load balancing SPI for internal tasks. if (!dfltLoadBalancingSpi) spis.add(new RoundRobinLoadBalancingSpi()); cfg.setLoadBalancingSpi(spis.toArray(new LoadBalancingSpi[spis.size()])); } if (cfg.getIndexingSpi() == null) cfg.setIndexingSpi(new NoopIndexingSpi()); if (cfg.getEncryptionSpi() == null) cfg.setEncryptionSpi(new NoopEncryptionSpi()); if (F.isEmpty(cfg.getMetricExporterSpi())) cfg.setMetricExporterSpi(new NoopMetricExporterSpi()); if (F.isEmpty(cfg.getSystemViewExporterSpi())) { if (IgniteComponentType.INDEXING.inClassPath()) { try { cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi(), U.newInstance(SYSTEM_VIEW_SQL_SPI)); } catch (IgniteCheckedException e) { throw new IgniteException(e); } } else cfg.setSystemViewExporterSpi(new JmxSystemViewExporterSpi()); } }
Example 8
Source File: IgniteCacheAbstractTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); TcpDiscoverySpi disco = (TcpDiscoverySpi)cfg.getDiscoverySpi(); disco.setForceServerMode(true); if (isDebug()) disco.setAckTimeout(Integer.MAX_VALUE); MemoryEventStorageSpi evtSpi = new MemoryEventStorageSpi(); evtSpi.setExpireCount(100); cfg.setEventStorageSpi(evtSpi); cfg.setDiscoverySpi(disco); cfg.setCacheConfiguration(cacheConfiguration(igniteInstanceName)); return cfg; }
Example 9
Source File: IgniteWalIteratorSwitchSegmentTest.java From ignite with Apache License 2.0 | 4 votes |
/*** * Initiate WAL manager. * * @param serVer WAL serializer version. * @param workDir Work directory path. * @return Tuple of WAL manager and WAL record serializer. * @throws IgniteCheckedException If some think failed. */ private T2<IgniteWriteAheadLogManager, RecordSerializer> initiate( int serVer, String workDir ) throws IgniteCheckedException { GridKernalContext kctx = new StandaloneGridKernalContext( log, null, null ) { @Override protected IgniteConfiguration prepareIgniteConfiguration() { IgniteConfiguration cfg = super.prepareIgniteConfiguration(); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setWalSegmentSize(SEGMENT_SIZE) .setWalRecordIteratorBufferSize(SEGMENT_SIZE / 2) .setWalMode(WALMode.FSYNC) .setWalPath(workDir + WORK_SUB_DIR) .setWalArchivePath(workDir + ARCHIVE_SUB_DIR) .setFileIOFactory(new RandomAccessFileIOFactory()) ); cfg.setEventStorageSpi(new NoopEventStorageSpi()); return cfg; } @Override public GridInternalSubscriptionProcessor internalSubscriptionProcessor() { return new GridInternalSubscriptionProcessor(this); } @Override public GridEventStorageManager event() { return new GridEventStorageManager(this); } }; IgniteWriteAheadLogManager walMgr = new FileWriteAheadLogManager(kctx); GridTestUtils.setFieldValue(walMgr, "serializerVer", serVer); GridCacheSharedContext<?, ?> ctx = new GridCacheSharedContext<>( kctx, null, null, null, null, walMgr, new WalStateManager(kctx), new GridCacheDatabaseSharedManager(kctx), null, null, null, null, null, new GridCacheIoManager(), null, null, null, null, null, null, null ); walMgr.start(ctx); walMgr.onActivate(kctx); walMgr.resumeLogging(null); RecordSerializer recordSerializer = new RecordSerializerFactoryImpl(ctx) .createSerializer(walMgr.serializerVersion()); return new T2<>(walMgr, recordSerializer); }
Example 10
Source File: CacheContinuousQueryOrderingEventTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); MemoryEventStorageSpi storeSpi = new MemoryEventStorageSpi(); storeSpi.setExpireCount(100); cfg.setEventStorageSpi(storeSpi); return cfg; }
Example 11
Source File: CacheContinuousQueryFailoverAbstractSelfTest.java From ignite with Apache License 2.0 | 3 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); TestCommunicationSpi commSpi = new TestCommunicationSpi(); commSpi.setSharedMemoryPort(-1); commSpi.setIdleConnectionTimeout(100); cfg.setCommunicationSpi(commSpi); MemoryEventStorageSpi evtSpi = new MemoryEventStorageSpi(); evtSpi.setExpireCount(50); cfg.setEventStorageSpi(evtSpi); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(cacheMode()); ccfg.setAtomicityMode(atomicityMode()); ccfg.setBackups(backups); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setNearConfiguration(nearCacheConfiguration()); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 12
Source File: CacheContinuousQueryOperationFromCallbackTest.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.setSystemThreadPoolSize(SYSTEM_POOL_SIZE); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); MemoryEventStorageSpi storeSpi = new MemoryEventStorageSpi(); storeSpi.setExpireCount(100); cfg.setEventStorageSpi(storeSpi); return cfg; }
Example 13
Source File: AgentClusterDemo.java From ignite with Apache License 2.0 | 2 votes |
/** * Configure node. * * @param basePort Base port. * @param gridIdx Ignite instance name index. * @param client If {@code true} then start client node. * @return IgniteConfiguration */ private static IgniteConfiguration igniteConfiguration(int basePort, int gridIdx, boolean client) throws IgniteCheckedException { IgniteConfiguration cfg = new IgniteConfiguration(); cfg.setGridLogger(new Slf4jLogger()); cfg.setIgniteInstanceName((client ? CLN_NODE_NAME : SRV_NODE_NAME) + gridIdx); cfg.setLocalHost("127.0.0.1"); cfg.setEventStorageSpi(new MemoryEventStorageSpi()); cfg.setConsistentId(cfg.getIgniteInstanceName()); File workDir = new File(U.workDirectory(null, null), "demo-work"); cfg.setWorkDirectory(workDir.getAbsolutePath()); int[] evts = new int[EVTS_DISCOVERY.length + VISOR_TASK_EVTS.length]; System.arraycopy(EVTS_DISCOVERY, 0, evts, 0, EVTS_DISCOVERY.length); System.arraycopy(VISOR_TASK_EVTS, 0, evts, EVTS_DISCOVERY.length, VISOR_TASK_EVTS.length); cfg.setIncludeEventTypes(evts); cfg.getConnectorConfiguration().setPort(basePort); System.setProperty(IGNITE_JETTY_PORT, String.valueOf(basePort + 10)); TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); int discoPort = basePort + 20; ipFinder.setAddresses(Collections.singletonList("127.0.0.1:" + discoPort + ".." + (discoPort + NODE_CNT - 1))); // Configure discovery SPI. TcpDiscoverySpi discoSpi = new TcpDiscoverySpi(); discoSpi.setLocalPort(discoPort); discoSpi.setIpFinder(ipFinder); cfg.setDiscoverySpi(discoSpi); TcpCommunicationSpi commSpi = new TcpCommunicationSpi(); commSpi.setSharedMemoryPort(-1); commSpi.setMessageQueueLimit(10); int commPort = basePort + 30; commSpi.setLocalPort(commPort); cfg.setCommunicationSpi(commSpi); cfg.setGridLogger(new Slf4jLogger(log)); cfg.setMetricsLogFrequency(0); DataRegionConfiguration dataRegCfg = new DataRegionConfiguration(); dataRegCfg.setName("demo"); dataRegCfg.setMetricsEnabled(true); dataRegCfg.setMaxSize(DFLT_DATA_REGION_INITIAL_SIZE); dataRegCfg.setPersistenceEnabled(true); DataStorageConfiguration dataStorageCfg = new DataStorageConfiguration(); dataStorageCfg.setMetricsEnabled(true); dataStorageCfg.setStoragePath(PdsConsistentIdProcessor.DB_DEFAULT_FOLDER); dataStorageCfg.setDefaultDataRegionConfiguration(dataRegCfg); dataStorageCfg.setSystemRegionMaxSize(DFLT_DATA_REGION_INITIAL_SIZE); dataStorageCfg.setWalMode(LOG_ONLY); dataStorageCfg.setWalSegments(WAL_SEGMENTS); dataStorageCfg.setWalSegmentSize(WAL_SEGMENT_SZ); cfg.setDataStorageConfiguration(dataStorageCfg); cfg.setClientMode(client); return cfg; }