use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.
the class GridLifecycleAwareSelfTest method getConfiguration.
/** {@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;
}
use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.
the class GridCacheCommandHandlerSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
// Discovery config.
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
disco.setJoinTimeout(5000);
// Cache config.
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(CacheMode.LOCAL);
cacheCfg.setAtomicityMode(atomicityMode());
// Grid config.
IgniteConfiguration cfg = super.getConfiguration();
cfg.setLocalHost("127.0.0.1");
ConnectorConfiguration clnCfg = new ConnectorConfiguration();
clnCfg.setHost("127.0.0.1");
cfg.setConnectorConfiguration(clnCfg);
cfg.setDiscoverySpi(disco);
// Add 'null' cache configuration.
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.
the class IgniteNode method start.
/** {@inheritDoc} */
@Override
public void start(BenchmarkConfiguration cfg) throws Exception {
IgniteBenchmarkArguments args = new IgniteBenchmarkArguments();
BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<ignite-node>");
IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> tup = loadConfiguration(args.configuration());
IgniteConfiguration c = tup.get1();
assert c != null;
if (args.cleanWorkDirectory())
FileUtils.cleanDirectory(U.workDirectory(c.getWorkDirectory(), c.getIgniteHome()));
ApplicationContext appCtx = tup.get2();
assert appCtx != null;
CacheConfiguration[] ccfgs = c.getCacheConfiguration();
if (ccfgs != null) {
for (CacheConfiguration cc : ccfgs) {
// IgniteNode can not run in CLIENT_ONLY mode,
// except the case when it's used inside IgniteAbstractBenchmark.
boolean cl = args.isClientOnly() && (args.isNearCache() || clientMode);
if (cl)
c.setClientMode(true);
if (args.isNearCache()) {
NearCacheConfiguration nearCfg = new NearCacheConfiguration();
if (args.getNearCacheSize() != 0)
nearCfg.setNearEvictionPolicy(new LruEvictionPolicy(args.getNearCacheSize()));
cc.setNearConfiguration(nearCfg);
}
cc.setWriteSynchronizationMode(args.syncMode());
cc.setBackups(args.backups());
if (args.restTcpPort() != 0) {
ConnectorConfiguration ccc = new ConnectorConfiguration();
ccc.setPort(args.restTcpPort());
if (args.restTcpHost() != null)
ccc.setHost(args.restTcpHost());
c.setConnectorConfiguration(ccc);
}
cc.setReadThrough(args.isStoreEnabled());
cc.setWriteThrough(args.isStoreEnabled());
cc.setWriteBehindEnabled(args.isWriteBehind());
BenchmarkUtils.println(cfg, "Cache configured with the following parameters: " + cc);
}
} else
BenchmarkUtils.println(cfg, "There are no caches configured");
TransactionConfiguration tc = c.getTransactionConfiguration();
tc.setDefaultTxConcurrency(args.txConcurrency());
tc.setDefaultTxIsolation(args.txIsolation());
TcpCommunicationSpi commSpi = (TcpCommunicationSpi) c.getCommunicationSpi();
if (commSpi == null)
commSpi = new TcpCommunicationSpi();
c.setCommunicationSpi(commSpi);
if (args.getPageSize() != MemoryConfiguration.DFLT_PAGE_SIZE) {
MemoryConfiguration dbCfg = c.getMemoryConfiguration();
if (dbCfg == null) {
dbCfg = new MemoryConfiguration();
c.setMemoryConfiguration(dbCfg);
}
dbCfg.setPageSize(args.getPageSize());
}
ignite = IgniteSpring.start(c, appCtx);
BenchmarkUtils.println("Configured marshaller: " + ignite.cluster().localNode().attribute(ATTR_MARSHALLER));
}
use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.
the class JdbcLocalCachesSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cache = defaultCacheConfiguration();
cache.setName(CACHE_NAME);
cache.setCacheMode(LOCAL);
cache.setWriteSynchronizationMode(FULL_SYNC);
cache.setIndexedTypes(String.class, Integer.class);
cfg.setCacheConfiguration(cache);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
cfg.setConnectorConfiguration(new ConnectorConfiguration());
return cfg;
}
use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.
the class JdbcEmptyCacheSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration cache = defaultCacheConfiguration();
cache.setName(CACHE_NAME);
cache.setCacheMode(PARTITIONED);
cache.setBackups(1);
cache.setWriteSynchronizationMode(FULL_SYNC);
cache.setIndexedTypes(Byte.class, Byte.class);
cfg.setCacheConfiguration(cache);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
cfg.setConnectorConfiguration(new ConnectorConfiguration());
return cfg;
}
Aggregations