Java Code Examples for org.apache.ignite.configuration.IgniteConfiguration#isClientMode()
The following examples show how to use
org.apache.ignite.configuration.IgniteConfiguration#isClientMode() .
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: IgniteClientAffinityAssignmentSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (!cfg.isClientMode()) { CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(CacheMode.PARTITIONED); ccfg.setBackups(1); ccfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); ccfg.setNearConfiguration(null); ccfg.setAffinity(new RendezvousAffinityFunction(false, PARTS)); cfg.setCacheConfiguration(ccfg); } return cfg; }
Example 2
Source File: GridCacheJdbcBlobStoreMultithreadedSelfTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { MvccFeatureChecker.skipIfNotSupported(MvccFeatureChecker.Feature.CACHE_STORE); IgniteConfiguration c = super.getConfiguration(igniteInstanceName); if (!c.isClientMode()) { CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setWriteSynchronizationMode(FULL_SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setBackups(1); cc.setCacheStoreFactory(new TestStoreFactory()); cc.setReadThrough(true); cc.setWriteThrough(true); cc.setLoadPreviousValue(true); c.setCacheConfiguration(cc); } return c; }
Example 3
Source File: NearCachePutAllMultinodeTest.java From ignite with Apache License 2.0 | 6 votes |
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration c = super.getConfiguration(igniteInstanceName); if (!c.isClientMode()) { CacheConfiguration cc = defaultCacheConfiguration(); cc.setCacheMode(PARTITIONED); cc.setWriteSynchronizationMode(FULL_SYNC); cc.setAtomicityMode(TRANSACTIONAL); cc.setBackups(1); // Set store to disable one-phase commit. cc.setCacheStoreFactory(new TestFactory()); c.setCacheConfiguration(cc); } return c; }
Example 4
Source File: VisorBasicConfiguration.java From ignite with Apache License 2.0 | 5 votes |
/** * Create data transfer object for node basic configuration properties. * * @param ignite Grid. * @param c Grid configuration. */ public VisorBasicConfiguration(IgniteEx ignite, IgniteConfiguration c) { igniteInstanceName = c.getIgniteInstanceName(); ggHome = getProperty(IGNITE_HOME, c.getIgniteHome()); locHost = getProperty(IGNITE_LOCAL_HOST, c.getLocalHost()); marsh = compactClass(c.getMarshaller()); deployMode = c.getDeploymentMode(); clientMode = c.isClientMode(); daemon = boolValue(IGNITE_DAEMON, c.isDaemon()); jmxRemote = ignite.isJmxRemoteEnabled(); restart = ignite.isRestartEnabled(); netTimeout = c.getNetworkTimeout(); log = compactClass(c.getGridLogger()); discoStartupDelay = c.getDiscoveryStartupDelay(); mBeanSrv = compactClass(c.getMBeanServer()); noAscii = boolValue(IGNITE_NO_ASCII, false); noDiscoOrder = boolValue(IGNITE_NO_DISCO_ORDER, false); noShutdownHook = boolValue(IGNITE_NO_SHUTDOWN_HOOK, false); progName = getProperty(IGNITE_PROG_NAME); quiet = boolValue(IGNITE_QUIET, true); successFile = getProperty(IGNITE_SUCCESS_FILE); updateNtf = boolValue(IGNITE_UPDATE_NOTIFIER, true); activeOnStart = c.isActiveOnStart(); addrRslvr = compactClass(c.getAddressResolver()); cacheSanityCheckEnabled = c.isCacheSanityCheckEnabled(); clsLdr = compactClass(c.getClassLoader()); consistentId = c.getConsistentId() != null ? String.valueOf(c.getConsistentId()) : null; failureDetectionTimeout = c.getFailureDetectionTimeout(); igniteWorkDir = c.getWorkDirectory(); lateAffAssignment = c.isLateAffinityAssignment(); marshLocJobs = c.isMarshalLocalJobs(); metricsUpdateFreq = c.getMetricsUpdateFrequency(); clientFailureDetectionTimeout = c.getClientFailureDetectionTimeout(); sndRetryCnt = c.getNetworkSendRetryCount(); sndRetryDelay = c.getNetworkSendRetryDelay(); timeSrvPortBase = c.getTimeServerPortBase(); timeSrvPortRange = c.getTimeServerPortRange(); utilityCacheKeepAliveTime = c.getUtilityCacheKeepAliveTime(); }
Example 5
Source File: TcpDiscoverySpi.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Nullable @Override public Serializable consistentId() throws IgniteSpiException { if (consistentId == null) { initializeImpl(); initAddresses(); IgniteConfiguration cfg = ignite.configuration(); final Serializable cfgId = cfg.getConsistentId(); if (cfgId == null) { if (cfg.isClientMode() == Boolean.TRUE) consistentId = cfg.getNodeId(); else { List<String> sortedAddrs = new ArrayList<>(addrs.get1()); Collections.sort(sortedAddrs); if (getBoolean(IGNITE_CONSISTENT_ID_BY_HOST_WITHOUT_PORT)) consistentId = U.consistentId(sortedAddrs); else consistentId = U.consistentId(sortedAddrs, impl.boundPort()); } } else consistentId = cfgId; } return consistentId; }
Example 6
Source File: CacheGetInsideLockChangingTopologyTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); ((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1); if (!cfg.isClientMode()) { cfg.setCacheConfiguration(cacheConfiguration(TX_CACHE1, TRANSACTIONAL), cacheConfiguration(TX_CACHE2, TRANSACTIONAL), cacheConfiguration(ATOMIC_CACHE, ATOMIC)); } return cfg; }
Example 7
Source File: IgniteCacheClientReconnectTest.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.setPeerClassLoadingEnabled(false); if (!cfg.isClientMode()) { CacheConfiguration[] ccfgs = new CacheConfiguration[CACHES]; for (int i = 0; i < CACHES; i++) { CacheConfiguration ccfg = new CacheConfiguration(); ccfg.setCacheMode(PARTITIONED); ccfg.setAtomicityMode(TRANSACTIONAL); ccfg.setBackups(1); ccfg.setName("cache-" + i); ccfg.setWriteSynchronizationMode(FULL_SYNC); ccfg.setAffinity(new RendezvousAffinityFunction(PARTITIONS_CNT, null)); ccfgs[i] = ccfg; } cfg.setCacheConfiguration(ccfgs); } else ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(forceServerMode); return cfg; }
Example 8
Source File: ValidationOnNodeJoinUtils.java From ignite with Apache License 2.0 | 5 votes |
/** * @param c Ignite Configuration. * @param cc Cache Configuration. * @param ctx Context. * @return {@code true} if cache is starting on client node and this node is affinity node for the cache. */ private static boolean storesLocallyOnClient(IgniteConfiguration c, CacheConfiguration cc, GridKernalContext ctx) { if (c.isClientMode() && c.getDataStorageConfiguration() == null) { if (cc.getCacheMode() == LOCAL) return true; return ctx.discovery().cacheAffinityNode(ctx.discovery().localNode(), cc.getName()); } else return false; }
Example 9
Source File: CacheNoAffinityExchangeTest.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.setCommunicationSpi(new TestRecordingCommunicationSpi()); cfg.setDiscoverySpi(new TestDiscoverySpi().setIpFinder(IP_FINDER)); cfg.setActiveOnStart(false); cfg.setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration( new DataRegionConfiguration().setMaxSize(200 * 1024 * 1024))); if (cfg.isClientMode()) { // It is necessary to ensure that client always connects to grid(0). ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(CLIENT_IP_FINDER); if (startClientCaches) { CacheConfiguration<Integer, Integer> txCfg = new CacheConfiguration<Integer, Integer>() .setName(PARTITIONED_TX_CLIENT_CACHE_NAME) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL) .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC) .setAffinity(new RendezvousAffinityFunction(false, 32)) .setBackups(2); cfg.setCacheConfiguration(txCfg); } } return cfg; }
Example 10
Source File: CacheConcurrentReadThroughTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (!cfg.isClientMode()) { cfg.setPublicThreadPoolSize(SYS_THREADS); cfg.setSystemThreadPoolSize(SYS_THREADS); } return cfg; }
Example 11
Source File: IgnitePdsPartitionPreloadTest.java From ignite with Apache License 2.0 | 5 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (!cfg.isClientMode()) { String val = "node" + getTestIgniteInstanceIndex(gridName); cfg.setUserAttributes(Collections.singletonMap(TEST_ATTR, val)); cfg.setConsistentId(val); } DataStorageConfiguration memCfg = new DataStorageConfiguration() .setDataRegionConfigurations(new DataRegionConfiguration().setName(MEM).setInitialSize(10 * MB)) .setDefaultDataRegionConfiguration( new DataRegionConfiguration(). setMetricsEnabled(true). setMaxSize(50L * MB). setPersistenceEnabled(true). setName(DEFAULT_REGION)) .setWalMode(WALMode.LOG_ONLY) .setWalSegmentSize(16 * MB) .setPageSize(1024) .setMetricsEnabled(true); cfg.setDataStorageConfiguration(memCfg); cfg.setCacheConfiguration(cfgFactory.get()); return cfg; }
Example 12
Source File: GridCacheAtomicEntryProcessorDeploymentSelfTest.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 (cfg.isClientMode()) cfg.setClassLoader(getExternalClassLoader()); cfg.setDeploymentMode(depMode); cfg.setCacheConfiguration(cacheConfiguration()); cfg.setConnectorConfiguration(null); return cfg; }
Example 13
Source File: IgniteCacheP2pUnmarshallingNearErrorTest.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 (cfg.isClientMode() == null || !cfg.isClientMode()) { cfg.getCacheConfiguration()[0].setEvictionPolicy(new FifoEvictionPolicy(1)); cfg.getCacheConfiguration()[0].setOnheapCacheEnabled(true); } return cfg; }
Example 14
Source File: IgnitionEx.java From ignite with Apache License 2.0 | 5 votes |
/** * @param cfg Ignite configuration. */ private void initializeDataStorageConfiguration(IgniteConfiguration cfg) throws IgniteCheckedException { if (cfg.getDataStorageConfiguration() != null && (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null)) { throw new IgniteCheckedException("Data storage can be configured with either legacy " + "(MemoryConfiguration, PersistentStoreConfiguration) or new (DataStorageConfiguration) classes, " + "but not both."); } if (cfg.getMemoryConfiguration() != null || cfg.getPersistentStoreConfiguration() != null) convertLegacyDataStorageConfigurationToNew(cfg); if (!cfg.isClientMode() && cfg.getDataStorageConfiguration() == null) cfg.setDataStorageConfiguration(new DataStorageConfiguration()); }
Example 15
Source File: WalStateManager.java From ignite with Apache License 2.0 | 5 votes |
/** * Constructor. * * @param kernalCtx Kernal context. */ public WalStateManager(GridKernalContext kernalCtx) { if (kernalCtx != null) { IgniteConfiguration cfg = kernalCtx.config(); boolean client = cfg.isClientMode() != null && cfg.isClientMode(); srv = !client && !cfg.isDaemon(); log = kernalCtx.log(WalStateManager.class); } else { srv = false; log = null; } if (srv) { ioLsnr = new GridMessageListener() { @Override public void onMessage(UUID nodeId, Object msg, byte plc) { if (msg instanceof WalStateAckMessage) { WalStateAckMessage msg0 = (WalStateAckMessage) msg; msg0.senderNodeId(nodeId); onAck(msg0); } else U.warn(log, "Unexpected IO message (will ignore): " + msg); } }; } else ioLsnr = null; }
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: IgniteMarshallerCacheClientRequestsMappingOnMissTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (cfg.isClientMode()) cfg.setWorkDirectory(TMP_DIR); TcpDiscoverySpi disco = new TestTcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(REPLICATED); ccfg.setRebalanceMode(SYNC); ccfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(ccfg); return cfg; }
Example 18
Source File: GridCacheConfigurationValidationSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); // Default cache config. CacheConfiguration dfltCacheCfg = defaultCacheConfiguration(); dfltCacheCfg.setCacheMode(PARTITIONED); dfltCacheCfg.setRebalanceMode(ASYNC); dfltCacheCfg.setWriteSynchronizationMode(FULL_SYNC); dfltCacheCfg.setAffinity(new RendezvousAffinityFunction()); dfltCacheCfg.setIndexedTypes( Integer.class, String.class ); dfltCacheCfg.setName(CACHE_NAME_WITH_SPECIAL_CHARACTERS_PARTITIONED); // Non-default cache configuration. CacheConfiguration namedCacheCfg = defaultCacheConfiguration(); namedCacheCfg.setCacheMode(PARTITIONED); namedCacheCfg.setRebalanceMode(ASYNC); namedCacheCfg.setWriteSynchronizationMode(FULL_SYNC); namedCacheCfg.setAffinity(new RendezvousAffinityFunction()); // Local cache configuration. CacheConfiguration localCacheCfg = defaultCacheConfiguration(); localCacheCfg.setCacheMode(LOCAL); // Modify cache config according to test parameters. if (igniteInstanceName.contains(WRONG_PRELOAD_MODE_IGNITE_INSTANCE_NAME)) dfltCacheCfg.setRebalanceMode(SYNC); else if (igniteInstanceName.contains(WRONG_CACHE_MODE_IGNITE_INSTANCE_NAME)) dfltCacheCfg.setCacheMode(REPLICATED); else if (igniteInstanceName.contains(WRONG_AFFINITY_IGNITE_INSTANCE_NAME)) dfltCacheCfg.setAffinity(new TestRendezvousAffinityFunction()); else if (igniteInstanceName.contains(WRONG_AFFINITY_MAPPER_IGNITE_INSTANCE_NAME)) dfltCacheCfg.setAffinityMapper(new TestCacheDefaultAffinityKeyMapper()); if (igniteInstanceName.contains(DUP_CACHES_IGNITE_INSTANCE_NAME)) cfg.setCacheConfiguration(namedCacheCfg, namedCacheCfg); else if (igniteInstanceName.contains(DUP_DFLT_CACHES_IGNITE_INSTANCE_NAME)) cfg.setCacheConfiguration(dfltCacheCfg, dfltCacheCfg); else { // Normal configuration. if (!cfg.isClientMode()) cfg.setCacheConfiguration(dfltCacheCfg, namedCacheCfg, localCacheCfg); } if (igniteInstanceName.contains(RESERVED_FOR_DATASTRUCTURES_CACHE_NAME_IGNITE_INSTANCE_NAME)) namedCacheCfg.setName(DataStructuresProcessor.ATOMICS_CACHE_NAME + "@abc"); else { namedCacheCfg.setCacheMode(REPLICATED); namedCacheCfg.setName(CACHE_NAME_WITH_SPECIAL_CHARACTERS_REPLICATED); } if (igniteInstanceName.contains(RESERVED_FOR_DATASTRUCTURES_CACHE_GROUP_NAME_IGNITE_INSTANCE_NAME)) namedCacheCfg.setGroupName("default-ds-group"); return cfg; }
Example 19
Source File: GridCacheAbstractDataStructuresFailoverSelfTest.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); AtomicConfiguration atomicCfg = new AtomicConfiguration(); atomicCfg.setCacheMode(collectionCacheMode()); atomicCfg.setBackups(collectionConfiguration().getBackups()); cfg.setAtomicConfiguration(atomicCfg); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setName(TRANSACTIONAL_CACHE_NAME); ccfg.setAtomicityMode(TRANSACTIONAL); cfg.setCacheConfiguration(ccfg); if (cfg.isClientMode() == TRUE) ((TcpDiscoverySpi)(cfg.getDiscoverySpi())).setForceServerMode(true); return cfg; }
Example 20
Source File: IgniteDynamicCacheStartSelfTest.java From ignite with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); if (cfg.isClientMode()) ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setForceServerMode(true); cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE_NAME, testAttribute)); CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME); cacheCfg.setCacheMode(CacheMode.REPLICATED); cacheCfg.setName(STATIC_CACHE_NAME); cfg.setCacheConfiguration(cacheCfg); cfg.setIncludeEventTypes(EVT_CACHE_STARTED, EVT_CACHE_STOPPED, EventType.EVT_CACHE_NODES_LEFT); if (daemon) cfg.setDaemon(true); return cfg; }