Search in sources :

Example 1 with DiscoverySpi

use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.

the class GridifySingleSplitLoadTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();
    /* Uncomment following code if you start it manually. */
    CommunicationSpi commSpi = new TcpCommunicationSpi();
    cfg.setCommunicationSpi(commSpi);
    DiscoverySpi discoSpi = new TcpDiscoverySpi();
    cfg.setDiscoverySpi(discoSpi);
    /*
         */
    @SuppressWarnings("TypeMayBeWeakened") Log4JLogger log = (Log4JLogger) cfg.getGridLogger();
    log.getLogger("org.apache.ignite").setLevel(Level.INFO);
    return cfg;
}
Also used : CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) Log4JLogger(org.apache.ignite.logger.log4j.Log4JLogger) DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 2 with DiscoverySpi

use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.

the class TcpDiscoveryIpFinderAdapter method discoveryClientMode.

/**
     * @return {@code True} if TCP discovery works in client mode.
     */
protected boolean discoveryClientMode() {
    boolean clientMode;
    Ignite ignite0 = ignite;
    if (ignite0 != null) {
        // Can be null if used in tests without starting Ignite.
        DiscoverySpi discoSpi = ignite0.configuration().getDiscoverySpi();
        if (!(discoSpi instanceof TcpDiscoverySpi))
            throw new IgniteSpiException("TcpDiscoveryIpFinder should be used with TcpDiscoverySpi: " + discoSpi);
        clientMode = ignite0.configuration().isClientMode() && !((TcpDiscoverySpi) discoSpi).isForceServerMode();
    } else
        clientMode = false;
    return clientMode;
}
Also used : DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) Ignite(org.apache.ignite.Ignite) IgniteSpiException(org.apache.ignite.spi.IgniteSpiException) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 3 with DiscoverySpi

use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.

the class TcpDiscoverySnapshotHistoryTest method testHistorySupported.

/**
     * @throws Exception If any error occurs.
     */
public void testHistorySupported() throws Exception {
    try {
        final Ignite g = startGrid();
        DiscoverySpi spi = g.configuration().getDiscoverySpi();
        DiscoverySpiHistorySupport ann = U.getAnnotation(spi.getClass(), DiscoverySpiHistorySupport.class);
        assertNotNull("Spi does not have annotation for history support", ann);
        assertTrue("History support is disabled for current spi", ann.value());
    } finally {
        stopGrid();
    }
}
Also used : DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) DiscoverySpiHistorySupport(org.apache.ignite.spi.discovery.DiscoverySpiHistorySupport) Ignite(org.apache.ignite.Ignite)

Example 4 with DiscoverySpi

use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.

the class GridStealingLoadTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    JobStealingCollisionSpi colSpi = new JobStealingCollisionSpi();
    assert colSpi.getActiveJobsThreshold() == JobStealingCollisionSpi.DFLT_ACTIVE_JOBS_THRESHOLD;
    assert colSpi.getWaitJobsThreshold() == JobStealingCollisionSpi.DFLT_WAIT_JOBS_THRESHOLD;
    // One job at a time.
    colSpi.setActiveJobsThreshold(5);
    colSpi.setWaitJobsThreshold(0);
    colSpi.setMessageExpireTime(5000);
    JobStealingFailoverSpi failSpi = new JobStealingFailoverSpi();
    // Verify defaults.
    assert failSpi.getMaximumFailoverAttempts() == JobStealingFailoverSpi.DFLT_MAX_FAILOVER_ATTEMPTS;
    DiscoverySpi discoSpi = new TcpDiscoverySpi();
    cfg.setDiscoverySpi(discoSpi);
    cfg.setCollisionSpi(colSpi);
    cfg.setFailoverSpi(failSpi);
    return cfg;
}
Also used : JobStealingCollisionSpi(org.apache.ignite.spi.collision.jobstealing.JobStealingCollisionSpi) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) JobStealingFailoverSpi(org.apache.ignite.spi.failover.jobstealing.JobStealingFailoverSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 5 with DiscoverySpi

use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.

the class GridCancelledJobsMetricsSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    IgniteConfiguration cfg = super.getConfiguration();
    cfg.setCollisionSpi(colSpi);
    DiscoverySpi discoSpi = cfg.getDiscoverySpi();
    assert discoSpi instanceof TcpDiscoverySpi;
    cfg.setMetricsUpdateFrequency(500);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) DiscoverySpi(org.apache.ignite.spi.discovery.DiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

DiscoverySpi (org.apache.ignite.spi.discovery.DiscoverySpi)19 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)15 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)5 Ignite (org.apache.ignite.Ignite)4 CommunicationSpi (org.apache.ignite.spi.communication.CommunicationSpi)4 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)4 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 Map (java.util.Map)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 CI1 (org.apache.ignite.internal.util.typedef.CI1)2 IgniteProductVersion.fromString (org.apache.ignite.lang.IgniteProductVersion.fromString)2 DiscoveryDataBag (org.apache.ignite.spi.discovery.DiscoveryDataBag)2 DiscoverySpiDataExchange (org.apache.ignite.spi.discovery.DiscoverySpiDataExchange)2 Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1