Search in sources :

Example 51 with TcpCommunicationSpi

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

the class IgniteCacheSizeFailoverTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setAtomicityMode(ATOMIC);
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setBackups(1);
    cfg.setCacheConfiguration(ccfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 52 with TcpCommunicationSpi

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

the class TcpDiscoveryMultiThreadedTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@SuppressWarnings({ "IfMayBeConditional" })
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    UUID id = nodeId.get();
    if (id != null) {
        cfg.setNodeId(id);
        nodeId.set(null);
    }
    if (client())
        cfg.setClientMode(true);
    cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(ipFinder).setJoinTimeout(60_000).setNetworkTimeout(10_000));
    int[] evts = { EVT_NODE_FAILED, EVT_NODE_LEFT };
    Map<IgnitePredicate<? extends Event>, int[]> lsnrs = new HashMap<>();
    lsnrs.put(new IgnitePredicate<Event>() {

        @Override
        public boolean apply(Event evt) {
            DiscoveryEvent discoveryEvt = (DiscoveryEvent) evt;
            failedNodes.add(discoveryEvt.eventNode().id());
            return true;
        }
    }, evts);
    cfg.setLocalEventListeners(lsnrs);
    cfg.setCacheConfiguration();
    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
    cfg.setIncludeProperties();
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) HashMap(java.util.HashMap) IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent) Event(org.apache.ignite.events.Event) CacheEntryEvent(javax.cache.event.CacheEntryEvent) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent) UUID(java.util.UUID) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)

Example 53 with TcpCommunicationSpi

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

the class GridManagerStopSelfTest method testStopCommunicationManager.

/**
 * @throws Exception If failed.
 */
public void testStopCommunicationManager() throws Exception {
    CommunicationSpi spi = new TcpCommunicationSpi();
    injectLogger(spi);
    ctx.config().setCommunicationSpi(spi);
    ctx.config().setMarshaller(new BinaryMarshaller());
    GridIoManager mgr = new GridIoManager(ctx);
    mgr.onKernalStop(true);
    mgr.stop(false);
}
Also used : CommunicationSpi(org.apache.ignite.spi.communication.CommunicationSpi) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) BinaryMarshaller(org.apache.ignite.internal.binary.BinaryMarshaller) GridIoManager(org.apache.ignite.internal.managers.communication.GridIoManager) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)

Example 54 with TcpCommunicationSpi

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

the class GridIoManagerSelfTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() throws Exception {
    ctx.config().setCommunicationSpi(new TcpCommunicationSpi());
    ctx.config().setMarshaller(new JdkMarshaller());
    // Turn off peer class loading to simplify mocking.
    ctx.config().setPeerClassLoadingEnabled(false);
    // Register local and remote nodes in discovery manager.
    GridDiscoveryManager mockedDiscoveryMgr = Mockito.mock(GridDiscoveryManager.class);
    when(mockedDiscoveryMgr.localNode()).thenReturn(locNode);
    when(mockedDiscoveryMgr.remoteNodes()).thenReturn(F.<ClusterNode>asList(rmtNode));
    ctx.add(mockedDiscoveryMgr);
}
Also used : GridDiscoveryManager(org.apache.ignite.internal.managers.discovery.GridDiscoveryManager) JdkMarshaller(org.apache.ignite.marshaller.jdk.JdkMarshaller) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)

Example 55 with TcpCommunicationSpi

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

the class TaskNodeRestartTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    ((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
    ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
    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)

Aggregations

TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)113 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)98 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)75 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)30 MemoryEventStorageSpi (org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi)8 TransactionConfiguration (org.apache.ignite.configuration.TransactionConfiguration)6 CommunicationSpi (org.apache.ignite.spi.communication.CommunicationSpi)6 AtomicConfiguration (org.apache.ignite.configuration.AtomicConfiguration)5 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)5 HashMap (java.util.HashMap)4 IgniteException (org.apache.ignite.IgniteException)4 ClusterNode (org.apache.ignite.cluster.ClusterNode)4 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)4 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)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 DiscoverySpi (org.apache.ignite.spi.discovery.DiscoverySpi)3 ArrayList (java.util.ArrayList)2