Search in sources :

Example 6 with AbstractFailureHandler

use of org.apache.ignite.failure.AbstractFailureHandler in project ignite by apache.

the class IgnitePdsTaskCancelingTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    cfg.setFailureHandler(new AbstractFailureHandler() {

        @Override
        protected boolean handle(Ignite ignite, FailureContext failureCtx) {
            failure.set(true);
            return true;
        }
    });
    cfg.setCacheConfiguration(new CacheConfiguration().setName(DEFAULT_CACHE_NAME).setAffinity(new RendezvousAffinityFunction(false, NUM_TASKS / 2)));
    cfg.setDataStorageConfiguration(getDataStorageConfiguration());
    // Set the thread pool size according to the NUM_TASKS.
    cfg.setPublicThreadPoolSize(16);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FailureContext(org.apache.ignite.failure.FailureContext) AbstractFailureHandler(org.apache.ignite.failure.AbstractFailureHandler) Ignite(org.apache.ignite.Ignite) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 7 with AbstractFailureHandler

use of org.apache.ignite.failure.AbstractFailureHandler in project ignite by apache.

the class CacheGetReadFromBackupFailoverTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setFailureHandler(new AbstractFailureHandler() {

        @Override
        protected boolean handle(Ignite ignite, FailureContext failureCtx) {
            err.compareAndSet(null, failureCtx.error());
            stop.set(true);
            return false;
        }
    });
    cfg.setConsistentId(igniteInstanceName);
    CacheConfiguration<Long, Long> txCcfg = new CacheConfiguration<Long, Long>(TX_CACHE).setAtomicityMode(TRANSACTIONAL).setCacheMode(PARTITIONED).setBackups(1).setWriteSynchronizationMode(FULL_SYNC).setReadFromBackup(true);
    CacheConfiguration<Long, Long> atomicCcfg = new CacheConfiguration<Long, Long>(ATOMIC_CACHE).setAtomicityMode(ATOMIC).setCacheMode(PARTITIONED).setBackups(1).setWriteSynchronizationMode(FULL_SYNC).setReadFromBackup(true);
    cfg.setCacheConfiguration(txCcfg, atomicCcfg);
    // Enforce different mac adresses to emulate distributed environment by default.
    cfg.setUserAttributes(Collections.singletonMap(IgniteNodeAttributes.ATTR_MACS_OVERRIDE, UUID.randomUUID().toString()));
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FailureContext(org.apache.ignite.failure.FailureContext) AbstractFailureHandler(org.apache.ignite.failure.AbstractFailureHandler) Ignite(org.apache.ignite.Ignite)

Example 8 with AbstractFailureHandler

use of org.apache.ignite.failure.AbstractFailureHandler in project ignite by apache.

the class IgniteCacheContinuousQueryClientTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setFailureHandler(new AbstractFailureHandler() {

        @Override
        protected boolean handle(Ignite ignite, FailureContext failureCtx) {
            failure.set(true);
            return true;
        }
    });
    CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    ccfg.setCacheMode(PARTITIONED);
    ccfg.setAtomicityMode(atomicityMode());
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    cfg.setCacheConfiguration(ccfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FailureContext(org.apache.ignite.failure.FailureContext) AbstractFailureHandler(org.apache.ignite.failure.AbstractFailureHandler) Ignite(org.apache.ignite.Ignite) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 9 with AbstractFailureHandler

use of org.apache.ignite.failure.AbstractFailureHandler in project ignite by apache.

the class GridP2PContinuousDeploymentClientDisconnectTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    cfg.setCacheConfiguration(defaultCacheConfiguration());
    cfg.setGridLogger(testLog);
    cfg.setFailureHandler(new AbstractFailureHandler() {

        /**
         * {@inheritDoc}
         */
        @Override
        protected boolean handle(Ignite ignite, FailureContext failureCtx) {
            failure.set(true);
            return false;
        }
    });
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) FailureContext(org.apache.ignite.failure.FailureContext) AbstractFailureHandler(org.apache.ignite.failure.AbstractFailureHandler) Ignite(org.apache.ignite.Ignite)

Aggregations

Ignite (org.apache.ignite.Ignite)9 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)9 AbstractFailureHandler (org.apache.ignite.failure.AbstractFailureHandler)9 FailureContext (org.apache.ignite.failure.FailureContext)9 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)3 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)3 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)2 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)2 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)2 IOException (java.io.IOException)1 SocketException (java.net.SocketException)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteClientDisconnectedException (org.apache.ignite.IgniteClientDisconnectedException)1 IgniteException (org.apache.ignite.IgniteException)1 SystemDataRegionConfiguration (org.apache.ignite.configuration.SystemDataRegionConfiguration)1 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)1 IgniteSpiException (org.apache.ignite.spi.IgniteSpiException)1