Search in sources :

Example 16 with TcpCommunicationSpi

use of org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi in project ignite by apache.

the class IgniteCommunicationBalanceTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpCommunicationSpi commSpi = ((TcpCommunicationSpi) cfg.getCommunicationSpi());
    commSpi.setSharedMemoryPort(-1);
    commSpi.setConnectionsPerNode(connectionsPerNode());
    commSpi.setUsePairedConnections(usePairedConnections());
    if (selectors > 0)
        commSpi.setSelectorsCount(selectors);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    cfg.setClientMode(client);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 17 with TcpCommunicationSpi

use of org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi in project ignite by apache.

the class GridCachePutAllFailoverSelfTest method getConfiguration.

/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    cfg.setPeerClassLoadingEnabled(false);
    cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);
    TcpDiscoverySpi discoverySpi = new TcpDiscoverySpi();
    discoverySpi.setAckTimeout(60000);
    discoverySpi.setIpFinder(ipFinder);
    discoverySpi.setForceServerMode(true);
    cfg.setDiscoverySpi(discoverySpi);
    if (igniteInstanceName.startsWith("master")) {
        cfg.setClientMode(true);
        cfg.setUserAttributes(ImmutableMap.of("segment", "master"));
        // For sure.
        failoverSpi.setMaximumFailoverAttempts(100);
        cfg.setFailoverSpi(failoverSpi);
    } else if (igniteInstanceName.startsWith("worker")) {
        cfg.setUserAttributes(ImmutableMap.of("segment", "worker"));
        CacheConfiguration cacheCfg = defaultCacheConfiguration();
        cacheCfg.setName("partitioned");
        cacheCfg.setAtomicityMode(atomicityMode());
        cacheCfg.setCacheMode(PARTITIONED);
        cacheCfg.setBackups(backups);
        cacheCfg.setNearConfiguration(nearEnabled ? new NearCacheConfiguration() : null);
        cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
        cfg.setCacheConfiguration(cacheCfg);
    } else
        throw new IllegalStateException("Unexpected Ignite instance name: " + igniteInstanceName);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration)

Example 18 with TcpCommunicationSpi

use of org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi in project ignite by apache.

the class CacheLoadingConcurrentGridStartSelfTest method getConfiguration.

/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setLateAffinityAssignment(true);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setBackups(1);
    ccfg.setCacheStoreFactory(new FactoryBuilder.SingletonFactory(new TestCacheStoreAdapter()));
    if (getTestIgniteInstanceName(0).equals(igniteInstanceName)) {
        if (client)
            cfg.setClientMode(true);
        if (configured)
            cfg.setCacheConfiguration(ccfg);
    } else
        cfg.setCacheConfiguration(ccfg);
    if (!configured) {
        ccfg.setNodeFilter(new P1<ClusterNode>() {

            @Override
            public boolean apply(ClusterNode node) {
                String name = node.attribute(ATTR_IGNITE_INSTANCE_NAME).toString();
                return !getTestIgniteInstanceName(0).equals(name);
            }
        });
    }
    return cfg;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FactoryBuilder(javax.cache.configuration.FactoryBuilder) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 19 with TcpCommunicationSpi

use of org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi in project ignite by apache.

the class IgniteCachePutRetryAbstractSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setIncludeEventTypes();
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    AtomicConfiguration acfg = new AtomicConfiguration();
    acfg.setBackups(1);
    cfg.setAtomicConfiguration(acfg);
    cfg.setIncludeEventTypes(new int[0]);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) AtomicConfiguration(org.apache.ignite.configuration.AtomicConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 20 with TcpCommunicationSpi

use of org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi in project ignite by apache.

the class GridMultipleJobsSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(ipFinder);
    c.setDiscoverySpi(disco);
    if (getTestIgniteInstanceName(1).equals(igniteInstanceName))
        c.setCacheConfiguration();
    else {
        CacheConfiguration cc = defaultCacheConfiguration();
        cc.setCacheMode(PARTITIONED);
        cc.setBackups(1);
        c.setCacheConfiguration(cc);
    }
    TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
    commSpi.setSharedMemoryPort(-1);
    c.setCommunicationSpi(commSpi);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)109 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)94 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)72 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)29 MemoryEventStorageSpi (org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi)8 CommunicationSpi (org.apache.ignite.spi.communication.CommunicationSpi)6 ClusterNode (org.apache.ignite.cluster.ClusterNode)5 AtomicConfiguration (org.apache.ignite.configuration.AtomicConfiguration)5 TransactionConfiguration (org.apache.ignite.configuration.TransactionConfiguration)5 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)5 HashMap (java.util.HashMap)4 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)4 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)4 LinkedHashMap (java.util.LinkedHashMap)3 UUID (java.util.UUID)3 IgniteException (org.apache.ignite.IgniteException)3 GridIoManager (org.apache.ignite.internal.managers.communication.GridIoManager)3 DiscoverySpi (org.apache.ignite.spi.discovery.DiscoverySpi)3 ArrayList (java.util.ArrayList)2 CountDownLatch (java.util.concurrent.CountDownLatch)2