use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class GridCachePartitionedWritesTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(CacheMode.PARTITIONED);
cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cc.setAtomicityMode(TRANSACTIONAL);
assert store != null;
cc.setCacheStoreFactory(singletonFactory(store));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
c.setCacheConfiguration(cc);
return c;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class IgniteNoClassOnServerAbstractTest method createConfiguration.
/**
* @return Configuration.
*/
private IgniteConfiguration createConfiguration() {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setPeerClassLoadingEnabled(false);
cfg.setLocalHost("127.0.0.1");
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinderCleanFrequency(1000);
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class PlatformConfigurationUtils method writeDiscoveryConfiguration.
/**
* Writes discovery configuration.
*
* @param w Writer.
* @param spi Disco.
*/
private static void writeDiscoveryConfiguration(BinaryRawWriter w, DiscoverySpi spi) {
assert w != null;
assert spi != null;
if (!(spi instanceof TcpDiscoverySpi)) {
w.writeBoolean(false);
return;
}
w.writeBoolean(true);
TcpDiscoverySpi tcp = (TcpDiscoverySpi) spi;
TcpDiscoveryIpFinder finder = tcp.getIpFinder();
if (finder instanceof TcpDiscoveryVmIpFinder) {
w.writeBoolean(true);
boolean isMcast = finder instanceof TcpDiscoveryMulticastIpFinder;
w.writeByte((byte) (isMcast ? 2 : 1));
Collection<InetSocketAddress> addrs = finder.getRegisteredAddresses();
w.writeInt(addrs.size());
for (InetSocketAddress a : addrs) w.writeString(a.toString());
if (isMcast) {
TcpDiscoveryMulticastIpFinder multiFinder = (TcpDiscoveryMulticastIpFinder) finder;
w.writeString(multiFinder.getLocalAddress());
w.writeString(multiFinder.getMulticastGroup());
w.writeInt(multiFinder.getMulticastPort());
w.writeInt(multiFinder.getAddressRequestAttempts());
w.writeInt(multiFinder.getResponseWaitTime());
int ttl = multiFinder.getTimeToLive();
w.writeBoolean(ttl != -1);
if (ttl != -1)
w.writeInt(ttl);
}
} else
w.writeBoolean(false);
w.writeLong(tcp.getSocketTimeout());
w.writeLong(tcp.getAckTimeout());
w.writeLong(tcp.getMaxAckTimeout());
w.writeLong(tcp.getNetworkTimeout());
w.writeLong(tcp.getJoinTimeout());
w.writeBoolean(tcp.isForceServerMode());
w.writeBoolean(tcp.isClientReconnectDisabled());
w.writeString(tcp.getLocalAddress());
w.writeInt(tcp.getReconnectCount());
w.writeInt(tcp.getLocalPort());
w.writeInt(tcp.getLocalPortRange());
w.writeLong(tcp.getStatisticsPrintFrequency());
w.writeLong(tcp.getIpFinderCleanFrequency());
w.writeInt(tcp.getThreadPriority());
w.writeInt((int) tcp.getTopHistorySize());
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class MemcacheRestExampleNodeStartup method configuration.
/**
* Create Ignite configuration with IGFS and enabled IPC.
*
* @return Ignite configuration.
* @throws IgniteException If configuration creation failed.
*/
public static IgniteConfiguration configuration() throws IgniteException {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setLocalHost("127.0.0.1");
cfg.setDeploymentMode(SHARED);
cfg.setPeerClassLoadingEnabled(true);
cfg.setConnectorConfiguration(new ConnectorConfiguration());
CacheConfiguration cacheCfg = new CacheConfiguration();
cacheCfg.setName("default");
cacheCfg.setAtomicityMode(TRANSACTIONAL);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setRebalanceMode(SYNC);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
cfg.setCacheConfiguration(cacheCfg);
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
discoSpi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(discoSpi);
return cfg;
}
use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.
the class JdbcBulkLoadSelfTest method getConfiguration0.
/**
* @param gridName Grid name.
* @return Grid configuration used for starting the grid.
* @throws Exception If failed.
*/
private IgniteConfiguration getConfiguration0(String gridName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(gridName);
CacheConfiguration<?, ?> cache = defaultCacheConfiguration();
cache.setCacheMode(PARTITIONED);
cache.setBackups(1);
cache.setWriteSynchronizationMode(FULL_SYNC);
cache.setIndexedTypes(Integer.class, Person.class);
cfg.setCacheConfiguration(cache);
cfg.setLocalHost("127.0.0.1");
TcpDiscoverySpi disco = new TcpDiscoverySpi();
TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47501"));
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setConnectorConfiguration(new ConnectorConfiguration());
return cfg;
}
Aggregations