Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#setGridLogger()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#setGridLogger() .
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: CheckpointBufferDeadlockTest.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.setDataStorageConfiguration( new DataStorageConfiguration() .setFileIOFactory(new SlowCheckpointFileIOFactory()) .setCheckpointThreads(checkpointThreads) .setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) .setMaxSize(MAX_SIZE) .setCheckpointPageBufferSize(CP_BUF_SIZE) ) ); cfg.setFailureHandler(new StopNodeFailureHandler()); cfg.setGridLogger(log); return cfg; }
Example 2
Source File: IgniteSemaphoreAbstractSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** * @throws Exception If failed. */ @Test public void testSemaphoreClosing() throws Exception { IgniteConfiguration cfg; GridStringLogger stringLogger; stringLogger = new GridStringLogger(); cfg = optimize(getConfiguration("npeGrid")); cfg.setGridLogger(stringLogger); try (Ignite ignite = startGrid(cfg.getIgniteInstanceName(), cfg)) { ignite.semaphore("semaphore", 1, true, true); } assertFalse(stringLogger.toString().contains(NullPointerException.class.getName())); }
Example 3
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 4
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 5
Source File: ListeningTestLoggerTest.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.setGridLogger(log); return cfg; }
Example 6
Source File: DhtAndNearEvictionTest.java From ignite with Apache License 2.0 | 5 votes |
/** */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.EVICTION); IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setGridLogger(strLog); TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(); ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47501")); cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder)); return cfg; }
Example 7
Source File: TcpDiscoverySpiMBeanTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(final String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); TcpDiscoverySpi tcpSpi = new TcpDiscoverySpi(); tcpSpi.setIpFinder(IP_FINDER); cfg.setDiscoverySpi(tcpSpi); cfg.setGridLogger(strLog); return cfg; }
Example 8
Source File: ClientConfigurationTest.java From ignite with Apache License 2.0 | 5 votes |
/** * Test check the case when {@link IgniteConfiguration#getRebalanceThreadPoolSize()} is equal to {@link * IgniteConfiguration#getSystemThreadPoolSize()} */ @Test public void testRebalanceThreadPoolSize() { GridStringLogger gridStrLog = new GridStringLogger(); gridStrLog.logLength(1024 * 100); IgniteConfiguration cci = Config.getServerConfiguration().setClientMode(true); cci.setRebalanceThreadPoolSize(cci.getSystemThreadPoolSize()); cci.setGridLogger(gridStrLog); try ( Ignite si = Ignition.start(Config.getServerConfiguration()); Ignite ci = Ignition.start(cci)) { Set<ClusterNode> collect = si.cluster().nodes().stream() .filter(new Predicate<ClusterNode>() { @Override public boolean test(ClusterNode clusterNode) { return clusterNode.isClient(); } }) .collect(Collectors.toSet()); String log = gridStrLog.toString(); boolean containsMsg = log.contains("Setting the rebalance pool size has no effect on the client mode"); Assert.assertTrue(containsMsg); Assert.assertEquals(1, collect.size()); } }
Example 9
Source File: JdbcThinConnectionMvccEnabledSelfTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @SuppressWarnings({"deprecation", "unchecked"}) @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null)); cfg.setMarshaller(new BinaryMarshaller()); cfg.setGridLogger(new GridStringLogger()); return cfg; }
Example 10
Source File: GridCacheConfigurationConsistencySelfTest.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 (useStrLog) { strLog = new GridStringLogger(false, cfg.getGridLogger()); cfg.setGridLogger(strLog); } cfg.setDeploymentMode(depMode); if (cacheEnabled) { CacheConfiguration cacheCfg = defaultCacheConfiguration(); cacheCfg.setName(cacheName); cacheCfg.setCacheMode(cacheMode); cacheCfg.setAffinity(aff); cacheCfg.setBackups(backups); cacheCfg.setAtomicityMode(TRANSACTIONAL); if (initCache != null) initCache.apply(cacheCfg); cfg.setCacheConfiguration(cacheCfg); } else cfg.setCacheConfiguration(); return cfg; }
Example 11
Source File: IgniteUidAsConsistentIdMigrationTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { final IgniteConfiguration cfg = super.getConfiguration(gridName); if (configuredConsistentId != null) cfg.setConsistentId(configuredConsistentId); final DataStorageConfiguration dsCfg = new DataStorageConfiguration(); if (placeStorageInTemp) { final File tempDir = new File(System.getProperty("java.io.tmpdir")); pstStoreCustomPath = new File(tempDir, "Store"); pstWalStoreCustomPath = new File(tempDir, "WalStore"); pstWalArchCustomPath = new File(tempDir, "WalArchive"); dsCfg.setStoragePath(pstStoreCustomPath.getAbsolutePath()); dsCfg.setWalPath(pstWalStoreCustomPath.getAbsolutePath()); dsCfg.setWalArchivePath(pstWalArchCustomPath.getAbsolutePath()); } dsCfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration() .setMaxSize(32L * 1024 * 1024) .setPersistenceEnabled(true)); cfg.setDataStorageConfiguration(dsCfg); if (strLog != null) cfg.setGridLogger(strLog); return cfg; }
Example 12
Source File: GridTransactionsSystemUserTimeMetricsTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setGridLogger(testLog); boolean isClient = igniteInstanceName.contains(CLIENT); if (!isClient) { CacheConfiguration ccfg = new CacheConfiguration(CACHE_NAME); ccfg.setAtomicityMode(TRANSACTIONAL); ccfg.setBackups(1); ccfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(ccfg); } cfg.setMetricExporterSpi(new JmxMetricExporterSpi()); cfg.setCommunicationSpi(new TestCommunicationSpi()); return cfg; }
Example 13
Source File: RebuildIndexTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setConsistentId(gridName); cfg.setGridLogger(log); LinkedHashMap<String, String> fields = new LinkedHashMap<>(); fields.put("account", "java.lang.Integer"); fields.put("balance", "java.lang.Integer"); QueryEntity qryEntity = new QueryEntity() .setKeyType(UserKey.class.getName()) .setValueType(UserValue.class.getName()) .setKeyFields(new HashSet<>(Arrays.asList("account"))) .setFields(fields); LinkedHashMap<String, Boolean> idxFields = new LinkedHashMap<>(); idxFields.put("account", false); idxFields.put("balance", false); QueryIndex idx1 = new QueryIndex(idxFields, QueryIndexType.SORTED).setName("IDX_1"); QueryIndex idx2 = new QueryIndex("balance", QueryIndexType.SORTED, false, "IDX_2"); qryEntity.setIndexes(Arrays.asList(idx1, idx2)); cfg.setCacheConfiguration(new CacheConfiguration<UserKey, UserValue>() .setName(CACHE_NAME) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setCacheMode(REPLICATED) .setWriteSynchronizationMode(FULL_SYNC) .setAffinity(new RendezvousAffinityFunction(false, 1)) .setQueryEntities(Collections.singleton(qryEntity))); cfg.setDataStorageConfiguration( new DataStorageConfiguration() .setCheckpointFrequency(10000000) .setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true)) ); if (srvLog != null) cfg.setGridLogger(srvLog); return cfg; }
Example 14
Source File: WarningOnBigQueryResultsBaseTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName). setCacheConfiguration( new CacheConfiguration() .setName(CACHE0) .setSqlSchema("TEST0") .setQueryEntities(Collections.singleton(new QueryEntity(Long.class, Long.class) .setTableName("test0") .addQueryField("id", Long.class.getName(), null) .addQueryField("val", Long.class.getName(), null) .setKeyFieldName("id") .setValueFieldName("val"))) .setAffinity(new RendezvousAffinityFunction(false, 10)) .setNodeFilter((IgnitePredicate<ClusterNode>)node -> node.attribute(TEST0_ATTR) != null && (boolean)node.attribute(TEST0_ATTR)), new CacheConfiguration() .setName(CACHE1) .setSqlSchema("TEST1") .setQueryEntities(Collections.singleton(new QueryEntity(Long.class, Long.class) .setTableName("test1") .addQueryField("id", Long.class.getName(), null) .addQueryField("val", Long.class.getName(), null) .setKeyFieldName("id") .setValueFieldName("val"))) .setAffinity(new RendezvousAffinityFunction(false, 10)) .setNodeFilter((IgnitePredicate<ClusterNode>)node -> node.attribute(TEST1_ATTR) != null && (boolean)node.attribute(TEST1_ATTR))); if (igniteInstanceName.startsWith("cli")) { cfg.setClientMode(true) .setClientConnectorConfiguration(new ClientConnectorConfiguration() .setPort(CLI_PORT)); } else { cfg.setUserAttributes(Collections.singletonMap( getTestIgniteInstanceIndex(igniteInstanceName) < 2 ? TEST0_ATTR : TEST1_ATTR, true)); } ListeningTestLogger testLog = new ListeningTestLogger(false, log); BigResultsLogListener lst = new BigResultsLogListener(); testLog.registerListener(lst); logListeners.put(igniteInstanceName, lst); cfg.setGridLogger(new ListeningTestLogger(false, testLog)); return cfg; }
Example 15
Source File: ServiceDeploymentNonSerializableStaticConfigurationTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); cfg.setGridLogger(log); ServiceConfiguration srvcCfg = new ServiceConfiguration(); srvcCfg.setName(TEST_SERVICE_NAME); srvcCfg.setMaxPerNodeCount(1); srvcCfg.setService(new NonSerializableService()); cfg.setServiceConfiguration(srvcCfg); return cfg; }
Example 16
Source File: GridCommandHandlerBrokenIndexTest.java From ignite with Apache License 2.0 | 4 votes |
/** * Adds error message listeners to server nodes. */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (cfg.isClientMode()) return cfg; ListeningTestLogger testLog = new ListeningTestLogger(false, log); Pattern logErrMsgPattern = Pattern.compile("Failed to lookup key: " + IDX_ISSUE_STR); LogListener lsnr = LogListener.matches(logErrMsgPattern).build(); testLog.registerListener(lsnr); lsnrs.add(lsnr); cfg.setGridLogger(testLog); return cfg; }
Example 17
Source File: PlatformDotNetConfigurationClosure.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected void apply0(IgniteConfiguration igniteCfg) { // Validate and copy Interop configuration setting environment pointer along the way. PlatformConfiguration interopCfg = igniteCfg.getPlatformConfiguration(); if (interopCfg != null && !(interopCfg instanceof PlatformDotNetConfiguration)) throw new IgniteException("Illegal platform configuration (must be of type " + PlatformDotNetConfiguration.class.getName() + "): " + interopCfg.getClass().getName()); PlatformDotNetConfiguration dotNetCfg = interopCfg != null ? (PlatformDotNetConfiguration)interopCfg : null; if (dotNetCfg == null) dotNetCfg = new PlatformDotNetConfiguration(); memMgr = new PlatformMemoryManagerImpl(gate, 1024); PlatformLogger logger = null; if (useLogger) { logger = new PlatformLogger(); logger.setGateway(gate); igniteCfg.setGridLogger(logger); } PlatformDotNetConfigurationEx dotNetCfg0 = new PlatformDotNetConfigurationEx(dotNetCfg, gate, memMgr, logger); igniteCfg.setPlatformConfiguration(dotNetCfg0); // Set Ignite home so that marshaller context works. String ggHome = igniteCfg.getIgniteHome(); if (ggHome != null) U.setIgniteHome(ggHome); // Callback to .Net. prepare(igniteCfg, dotNetCfg0); // Make sure binary config is right. setBinaryConfiguration(igniteCfg, dotNetCfg0); }
Example 18
Source File: H2TreeCorruptedTreeExceptionTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); cfg.setConsistentId(gridName); cfg.setCacheConfiguration(new CacheConfiguration<>() .setName(DEFAULT_CACHE_NAME) .setAffinity(new RendezvousAffinityFunction().setPartitions(1)) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) ); ListeningTestLogger listeningTestLog = new ListeningTestLogger(false, log); listeningTestLog.registerListener(logListener); listeningTestLog.registerListener(logSensListener); cfg.setGridLogger(listeningTestLog); return cfg; }
Example 19
Source File: BasicIndexTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { assertNotNull(inlineSize); for (QueryIndex index : indexes) index.setInlineSize(inlineSize); IgniteConfiguration igniteCfg = super.getConfiguration(igniteInstanceName); igniteCfg.setConsistentId(igniteInstanceName); if (igniteInstanceName.startsWith(CLIENT_NAME) && clientLog != null) igniteCfg.setGridLogger(clientLog); else if (srvLog != null) igniteCfg.setGridLogger(srvLog); LinkedHashMap<String, String> fields = new LinkedHashMap<>(); fields.put("keyStr", String.class.getName()); fields.put("keyLong", Long.class.getName()); fields.put("keyPojo", Pojo.class.getName()); fields.put("valStr", String.class.getName()); fields.put("valLong", Long.class.getName()); fields.put("valPojo", Pojo.class.getName()); if (!createIdx) indexes = Collections.emptyList(); CacheConfiguration<Key, Val> ccfg = new CacheConfiguration<Key, Val>(DEFAULT_CACHE_NAME) .setAffinity(new RendezvousAffinityFunction(false, 32)) .setQueryEntities(Collections.singleton( new QueryEntity() .setKeyType(Key.class.getName()) .setValueType(Val.class.getName()) .setFields(fields) .setKeyFields(new HashSet<>(Arrays.asList("keyStr", "keyLong", "keyPojo"))) .setIndexes(indexes) .setAliases(Collections.singletonMap(QueryUtils.KEY_FIELD_NAME, "pk_id")) )) .setSqlIndexMaxInlineSize(inlineSize); if (createStaticCache) igniteCfg.setCacheConfiguration(ccfg); if (srvLog != null) igniteCfg.setGridLogger(srvLog); if (isPersistenceEnabled) { igniteCfg.setDataStorageConfiguration(new DataStorageConfiguration() .setDefaultDataRegionConfiguration( new DataRegionConfiguration().setPersistenceEnabled(true).setMaxSize(10 * 1024 * 1024) ) ); } return igniteCfg .setFailureHandler(new StopNodeFailureHandler()); }
Example 20
Source File: GridLifecycleAwareSelfTest.java From ignite with Apache License 2.0 | 2 votes |
/** {@inheritDoc} */ @Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); TestConnectorMessageInterceptor interceptor = new TestConnectorMessageInterceptor(); ConnectorConfiguration clientCfg = new ConnectorConfiguration(); clientCfg.setMessageInterceptor(interceptor); cfg.setConnectorConfiguration(clientCfg); lifecycleAwares.add(interceptor); TestSegmentationResolver segmentationRslvr = new TestSegmentationResolver(); cfg.setSegmentationResolvers(segmentationRslvr); lifecycleAwares.add(segmentationRslvr); TestContextFactory ctxFactory = new TestContextFactory(); clientCfg.setSslContextFactory(ctxFactory); lifecycleAwares.add(ctxFactory); TestLifecycleBean lifecycleBean = new TestLifecycleBean(); cfg.setLifecycleBeans(lifecycleBean); lifecycleAwares.add(lifecycleBean); TestMarshaller marshaller = new TestMarshaller(); cfg.setMarshaller(marshaller); lifecycleAwares.add(marshaller.lifecycleAware()); TestLogger testLog = new TestLogger(); cfg.setGridLogger(testLog); lifecycleAwares.add(testLog.lifecycleAware()); return cfg; }