Search in sources :

Example 96 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridTcpSpiForwardingSelfTest method getConfiguration.

/** {@inheritDoc} */
@SuppressWarnings({ "IfMayBeConditional", "deprecation" })
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    if (ipFinderUseLocPorts)
        ipFinder.setAddresses(Arrays.asList("127.0.0.1:" + locPort1, "127.0.0.1:" + locPort2));
    else
        ipFinder.setAddresses(Arrays.asList("127.0.0.1:" + extPort1, "127.0.0.1:" + extPort2));
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    final int locPort;
    final int commLocPort;
    if (getTestIgniteInstanceName(0).equals(igniteInstanceName)) {
        locPort = locPort1;
        commLocPort = commLocPort1;
    } else if (getTestIgniteInstanceName(1).equals(igniteInstanceName)) {
        locPort = locPort2;
        commLocPort = commLocPort2;
    } else
        throw new IllegalArgumentException("Unknown Ignite instance name");
    spi.setIpFinder(ipFinder);
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    spi.setLocalPort(locPort);
    spi.setLocalPortRange(1);
    cfg.setDiscoverySpi(spi);
    cfg.setLocalHost("127.0.0.1");
    cfg.setConnectorConfiguration(null);
    TcpCommunicationSpi commSpi = new TcpCommunicationSpi() {

        @Override
        protected GridCommunicationClient createTcpClient(ClusterNode node, int connIdx) throws IgniteCheckedException {
            Map<String, Object> attrs = new HashMap<>(node.attributes());
            attrs.remove(createSpiAttributeName(ATTR_PORT));
            ((TcpDiscoveryNode) node).setAttributes(attrs);
            return super.createTcpClient(node, connIdx);
        }
    };
    commSpi.setLocalAddress("127.0.0.1");
    commSpi.setLocalPort(commLocPort);
    commSpi.setLocalPortRange(1);
    commSpi.setSharedMemoryPort(-1);
    commSpi.setConnectionsPerNode(1);
    cfg.setCommunicationSpi(commSpi);
    assert rslvr != null;
    cfg.setAddressResolver(rslvr);
    return cfg;
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) HashMap(java.util.HashMap) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 97 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridSessionWaitAttributeSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    c.setDiscoverySpi(discoSpi);
    c.setPublicThreadPoolSize(JOB_NUM * 2);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 98 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridSpiLocalHostInjectionTest method processTcpDiscoverySpiTestInjection.

/**
     * Performs test of {@code localHost} resource injection for {@link org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi}.
     *
     * @param cfgVal {@code true} if {@code localHost} should be set in configuration adapter.
     * @param spiVal {@code true} if {@code localHost} should be set in SPI
     * @param exp Expected value of {@code localHost} property in SPI after injection.
     * @throws IgniteCheckedException If test fails.
     */
private void processTcpDiscoverySpiTestInjection(boolean cfgVal, boolean spiVal, @Nullable String exp) throws IgniteCheckedException {
    GridResourceProcessor proc = getResourceProcessor(cfgVal);
    TcpDiscoverySpi spi = new TcpDiscoverySpi();
    if (spiVal)
        spi.setLocalAddress(SPI_LOCAL_ADDR_VALUE);
    proc.inject(spi);
    assertEquals("Invalid localAddr value after injection: ", exp, spi.getLocalAddress());
}
Also used : GridResourceProcessor(org.apache.ignite.internal.processors.resource.GridResourceProcessor) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 99 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridSessionSetJobAttributeSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    c.setDiscoverySpi(discoSpi);
    c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 100 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridSessionSetFutureAttributeSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    c.setDiscoverySpi(discoSpi);
    c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)650 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)633 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)287 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)73 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)69 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)55 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)36 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)34 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)31 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)31 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)21 ArrayList (java.util.ArrayList)15 Ignite (org.apache.ignite.Ignite)13 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)11 MemoryConfiguration (org.apache.ignite.configuration.MemoryConfiguration)11 QueryEntity (org.apache.ignite.cache.QueryEntity)10 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)10 DiscoverySpi (org.apache.ignite.spi.discovery.DiscoverySpi)10 MemoryEventStorageSpi (org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi)10 LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)9