• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CollectionConfiguration类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中org.apache.ignite.configuration.CollectionConfiguration的典型用法代码示例。如果您正苦于以下问题:Java CollectionConfiguration类的具体用法?Java CollectionConfiguration怎么用?Java CollectionConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CollectionConfiguration类属于org.apache.ignite.configuration包,在下文中一共展示了CollectionConfiguration类的38个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: start

点赞 4

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@PostConstruct
    public void start() {
        log.info("Application is started for Node:" + ignite.cluster().nodes());
        CollectionConfiguration cfg = new CollectionConfiguration();
        IgniteQueue<Object> queue = ignite.queue("main", 0, cfg);
        IgniteCache<UUID, Operation> operationCache = ignite.cache("operationCache");
        log.info("Application is started for KeySizes:" + operationCache.size(CachePeekMode.PRIMARY));
        ArrayList<Event> events = new ArrayList<>();
        events.add(new Event(UUID.randomUUID(), IEventType.EXECUTE, EventState.CREATED, new String[]{"firstpar1","firstpar2"}));
        operationCache.put(UUID.randomUUID(), new Operation("TEST_CREATE", events, TransactionState.RUNNING));
        log.info("Application is started for KeySizes:" + operationCache.size(CachePeekMode.PRIMARY));
/*        Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(new Runnable() {
            @Override
            public void run() {
                kafkaTemplate.send("operation-events",UUID.randomUUID(),
                        new Operation("blaaggre",Arrays.asList(new Event()),TransactionState.RUNNING));

            }
        }, 3,3, TimeUnit.SECONDS);*/

//        log.info(transactionCache.get(UUID.fromString("4447a089-e5f7-477c-9807-79210fafa296")).toString());
    }
 

开发者ID:kloiasoft,
项目名称:eventapis,
代码行数:23,
代码来源:EventController.java

示例2: testOperations

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@Test
public void testOperations() {
    boolean result = template.requestBody("ignite:set:abc?operation=ADD", "hello", boolean.class);
    assert_().that(result).isTrue();
    assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isTrue();

    result = template.requestBody("ignite:set:abc?operation=CONTAINS", "hello", boolean.class);
    assert_().that(result).isTrue();
    assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isTrue();

    result = template.requestBody("ignite:set:abc?operation=REMOVE", "hello", boolean.class);
    assert_().that(result).isTrue();
    assert_().that(ignite().set("abc", new CollectionConfiguration()).contains("hello")).isFalse();

    result = template.requestBody("ignite:set:abc?operation=CONTAINS", "hello", boolean.class);
    assert_().that(result).isFalse();
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:18,
代码来源:IgniteSetTest.java

示例3: testOperations

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@Test
public void testOperations() {
    boolean result = template.requestBody("ignite:queue:abc?operation=ADD", "hello", boolean.class);
    assert_().that(result).isTrue();
    assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isTrue();

    result = template.requestBody("ignite:queue:abc?operation=CONTAINS", "hello", boolean.class);
    assert_().that(result).isTrue();
    assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isTrue();

    result = template.requestBody("ignite:queue:abc?operation=REMOVE", "hello", boolean.class);
    assert_().that(result).isTrue();
    assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).contains("hello")).isFalse();

    result = template.requestBody("ignite:queue:abc?operation=CONTAINS", "hello", boolean.class);
    assert_().that(result).isFalse();
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:18,
代码来源:IgniteQueueTest.java

示例4: queue

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * Gets a queue from cache or creates one if it's not cached.
 *
 * @param name Name of queue.
 * @param grpName Group name. If present, will override groupName from configuration.
 * @param cap Max size of queue.
 * @param cfg Non-null queue configuration if new queue should be created.
 * @return Instance of queue.
 * @throws IgniteCheckedException If failed.
 */
@SuppressWarnings("unchecked")
public final <T> IgniteQueue<T> queue(final String name, @Nullable final String grpName, int cap,
    @Nullable final CollectionConfiguration cfg)
    throws IgniteCheckedException {
    A.notNull(name, "name");

    if (cfg != null) {
        if (cap <= 0)
            cap = Integer.MAX_VALUE;
    }

    final int cap0 = cap;

    final boolean create = cfg != null;

    return getCollection(new IgniteClosureX<GridCacheContext, IgniteQueue<T>>() {
        @Override public IgniteQueue<T> applyx(GridCacheContext ctx) throws IgniteCheckedException {
            return ctx.dataStructures().queue(name, cap0, create && cfg.isCollocated(), create);
        }
    }, cfg, name, grpName, QUEUE, create);
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:32,
代码来源:DataStructuresProcessor.java

示例5: queue

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public <T> IgniteQueue<T> queue(String name,
    int cap,
    CollectionConfiguration cfg) {
    guard();

    try {
        checkClusterState();

        return ctx.dataStructures().queue(name, null, cap, cfg);
    }
    catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
    finally {
        unguard();
    }
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:19,
代码来源:IgniteKernal.java

示例6: set

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public <T> IgniteSet<T> set(String name,
    CollectionConfiguration cfg) {
    guard();

    try {
        checkClusterState();

        return ctx.dataStructures().set(name, null, cfg);
    }
    catch (IgniteCheckedException e) {
        throw U.convertException(e);
    }
    finally {
        unguard();
    }
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:18,
代码来源:IgniteKernal.java

示例7: testNotReuseCache

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testNotReuseCache() throws Exception {
    CollectionConfiguration colCfg1 = collectionConfiguration();

    CollectionConfiguration colCfg2 = collectionConfiguration();

    if (colCfg2.getAtomicityMode() == ATOMIC)
        colCfg2.setAtomicityMode(TRANSACTIONAL);
    else
        colCfg2.setAtomicityMode(ATOMIC);

    IgniteQueue queue1 = grid(0).queue("Queue1", 0, colCfg1);

    IgniteQueue queue2 = grid(0).queue("Queue2", 0, colCfg2);

    assertNotSame(getQueueCache(queue1), getQueueCache(queue2));
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:20,
代码来源:GridCacheQueueApiSelfAbstractTest.java

示例8: testFilterNode

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testFilterNode() throws Exception {
    CollectionConfiguration colCfg1 = collectionConfiguration();

    CollectionConfiguration colCfg2 = collectionConfiguration();

    colCfg2.setNodeFilter(new IgnitePredicate<ClusterNode>() {
        @Override public boolean apply(ClusterNode node) {
            return true;
        }
    });

    grid(0).queue("Queue1", 0, colCfg1);

    try {
        grid(0).queue("Queue2", 0, colCfg2);

        fail("Exception was expected.");
    }
    catch (Exception ex) {
        // Expected
    }
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:26,
代码来源:GridCacheQueueApiSelfAbstractTest.java

示例9: testSystemCache

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testSystemCache() throws Exception {
    CollectionConfiguration colCfg = collectionConfiguration();

    IgniteQueue queue = grid(0).queue("Queue1", 0, colCfg);

    final CacheConfiguration ccfg = getQueueCache(queue);

    GridTestUtils.assertThrows(log, new Callable<Object>() {
        @Override public Object call() throws Exception {
            grid(0).cache(ccfg.getName());
            return null;
        }
    }, IllegalStateException.class, "Failed to get cache because it is a system cache");

    assertNotNull(((IgniteKernal)grid(0)).internalCache(ccfg.getName()));
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:20,
代码来源:GridCacheQueueApiSelfAbstractTest.java

示例10: testClientQueueCreateCloseFailover

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testClientQueueCreateCloseFailover() throws Exception {
    testFailoverWithClient(new IgniteInClosure<Ignite>() {
        @Override public void apply(Ignite ignite) {
            for (int i = 0; i < 100; i++) {
                CollectionConfiguration colCfg = new CollectionConfiguration();

                colCfg.setBackups(1);
                colCfg.setCacheMode(PARTITIONED);
                colCfg.setAtomicityMode(i % 2 == 0 ? TRANSACTIONAL : ATOMIC);

                IgniteQueue q = ignite.queue("q-" + i, 0, colCfg);

                q.close();
            }
        }
    });
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:21,
代码来源:IgniteAtomicLongChangingTopologySelfTest.java

示例11: testClientSetCreateCloseFailover

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
public void testClientSetCreateCloseFailover() throws Exception {
    testFailoverWithClient(new IgniteInClosure<Ignite>() {
        @Override public void apply(Ignite ignite) {
            for (int i = 0; i < 100; i++) {
                CollectionConfiguration colCfg = new CollectionConfiguration();

                colCfg.setBackups(1);
                colCfg.setCacheMode(PARTITIONED);
                colCfg.setAtomicityMode(i % 2 == 0 ? TRANSACTIONAL : ATOMIC);

                IgniteSet set = ignite.set("set-" + i, colCfg);

                set.close();
            }
        }
    });
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:21,
代码来源:IgniteAtomicLongChangingTopologySelfTest.java

示例12: initializeQueue

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * Initialize queue.
 *
 * @param ignite Ignite.
 * @param queueName Name of queue.
 * @return Queue.
 * @throws IgniteException If execution failed.
 */
private static IgniteQueue<String> initializeQueue(Ignite ignite, String queueName) throws IgniteException {
    CollectionConfiguration colCfg = new CollectionConfiguration();

    colCfg.setCacheMode(PARTITIONED);

    // Initialize new FIFO queue.
    IgniteQueue<String> queue = ignite.queue(queueName, 0, colCfg);

    // Initialize queue items.
    // We will be use blocking operation and queue size must be appropriated.
    for (int i = 0; i < ignite.cluster().nodes().size() * RETRIES * 2; i++)
        queue.put(Integer.toString(i));

    System.out.println("Queue size after initializing: " + queue.size());

    return queue;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:26,
代码来源:IgniteQueueExample.java

示例13: initializeSet

点赞 3

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * Initialize set.
 *
 * @param ignite Ignite.
 * @param setName Name of set.
 * @return Set.
 * @throws IgniteException If execution failed.
 */
private static IgniteSet<String> initializeSet(Ignite ignite, String setName) throws IgniteException {
    CollectionConfiguration setCfg = new CollectionConfiguration();

    setCfg.setAtomicityMode(TRANSACTIONAL);
    setCfg.setCacheMode(PARTITIONED);

    // Initialize new set.
    IgniteSet<String> set = ignite.set(setName, setCfg);

    // Initialize set items.
    for (int i = 0; i < 10; i++)
        set.add(Integer.toString(i));

    System.out.println("Set size after initializing: " + set.size());

    return set;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:26,
代码来源:IgniteSetExample.java

示例14: testWithConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@Test
public void testWithConfiguration() {
    CollectionConfiguration configuration = new CollectionConfiguration();
    configuration.setCacheMode(CacheMode.LOCAL);

    context.getRegistry(JndiRegistry.class).bind("config", configuration);

    IgniteSetEndpoint igniteEndpoint = context.getEndpoint("ignite:set:abc?operation=ADD&configuration=#config", IgniteSetEndpoint.class);
    template.requestBody(igniteEndpoint, "hello");

    assert_().that(ignite().set("abc", configuration).size()).isEqualTo(1);
    assert_().that(igniteEndpoint.getConfiguration()).isEqualTo(configuration);
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:14,
代码来源:IgniteSetTest.java

示例15: testWithConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@Test
public void testWithConfiguration() {
    CollectionConfiguration configuration = new CollectionConfiguration();
    configuration.setCacheMode(CacheMode.LOCAL);

    context.getRegistry(JndiRegistry.class).bind("config", configuration);

    IgniteQueueEndpoint igniteEndpoint = context.getEndpoint("ignite:queue:abc?operation=ADD&configuration=#config", IgniteQueueEndpoint.class);
    template.requestBody(igniteEndpoint, "hello");

    assert_().that(ignite().queue("abc", 0, configuration).size()).isEqualTo(1);
    assert_().that(igniteEndpoint.getConfiguration()).isEqualTo(configuration);
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:14,
代码来源:IgniteQueueTest.java

示例16: queue

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public <T> IgniteQueue<T> queue(String name,
    int cap,
    CollectionConfiguration cfg)
{
    checkIgnite();

    return g.queue(name, cap, cfg);
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:10,
代码来源:IgniteSpringBean.java

示例17: set

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public <T> IgniteSet<T> set(String name,
    CollectionConfiguration cfg)
{
    checkIgnite();

    return g.set(name, cfg);
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:9,
代码来源:IgniteSpringBean.java

示例18: cacheConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @param cfg Collection configuration.
 * @param name Cache name.
 * @param grpName Group name.
 * @return Cache configuration.
 */
private CacheConfiguration cacheConfiguration(CollectionConfiguration cfg, String name, String grpName) {
    CacheConfiguration ccfg = new CacheConfiguration();

    ccfg.setName(name);
    ccfg.setGroupName(grpName);
    ccfg.setBackups(cfg.getBackups());
    ccfg.setCacheMode(cfg.getCacheMode());
    ccfg.setAtomicityMode(cfg.getAtomicityMode());
    ccfg.setNodeFilter(cfg.getNodeFilter());
    ccfg.setWriteSynchronizationMode(FULL_SYNC);
    ccfg.setRebalanceMode(SYNC);

    return ccfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:21,
代码来源:DataStructuresProcessor.java

示例19: metaCacheConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @param cfg Collection configuration.
 * @param name Cache name.
 * @param grpName Group name.
 * @return Meta cache configuration.
 */
private CacheConfiguration metaCacheConfiguration(CollectionConfiguration cfg, String name, String grpName) {
    CacheConfiguration ccfg = cacheConfiguration(cfg, name, grpName);

    ccfg.setAtomicityMode(TRANSACTIONAL);

    return ccfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:14,
代码来源:DataStructuresProcessor.java

示例20: compatibleCache

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @param cfg Collection configuration.
 * @return Cache name.
 * @param grpName Group name.
 * @throws IgniteCheckedException If failed.
 */
@Nullable private IgniteInternalCache compatibleCache(CollectionConfiguration cfg, String grpName)
    throws IgniteCheckedException
{
    String cacheName = DS_CACHE_NAME_PREFIX + cfg.getAtomicityMode() + "_" + cfg.getCacheMode() + "_" +
        cfg.getBackups() + "@" + grpName;

    IgniteInternalCache cache = ctx.cache().cache(cacheName);

    if (cache == null) {
        ctx.cache().dynamicStartCache(cacheConfiguration(cfg, cacheName, grpName),
            cacheName,
            null,
            CacheType.DATA_STRUCTURES,
            false,
            false,
            true,
            true).get();
    }
    else {
        IgnitePredicate<ClusterNode> cacheNodeFilter = cache.context().group().nodeFilter();

        String clsName1 = cacheNodeFilter != null ? cacheNodeFilter.getClass().getName() :
            CacheConfiguration.IgniteAllNodesPredicate.class.getName();
        String clsName2 = cfg.getNodeFilter() != null ? cfg.getNodeFilter().getClass().getName() :
            CacheConfiguration.IgniteAllNodesPredicate.class.getName();

        if (!clsName1.equals(clsName2))
            throw new IgniteCheckedException("Could not add collection to group " + grpName +
                " because of different node filters [existing=" + clsName1 + ", new=" + clsName2 + "]");
    }

    cache = ctx.cache().getOrStartCache(cacheName);

    assert cache != null;

    return cache;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:44,
代码来源:DataStructuresProcessor.java

示例21: set

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * Gets a set from cache or creates one if it's not cached.
 *
 * @param name Set name.
 * @param grpName Group name. If present, will override groupName from configuration.
 * @param cfg Set configuration if new set should be created.
 * @return Set instance.
 * @throws IgniteCheckedException If failed.
 */
@SuppressWarnings("unchecked")
@Nullable public <T> IgniteSet<T> set(final String name, @Nullable final String grpName, @Nullable final CollectionConfiguration cfg)
    throws IgniteCheckedException {
    A.notNull(name, "name");

    final boolean create = cfg != null;

    return getCollection(new CX1<GridCacheContext, IgniteSet<T>>() {
        @Override public IgniteSet<T> applyx(GridCacheContext cctx) throws IgniteCheckedException {
            return cctx.dataStructures().set(name, create && cfg.isCollocated(), create);
        }
    }, cfg, name, grpName, SET, create);
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:23,
代码来源:DataStructuresProcessor.java

示例22: queue

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public <T> IgniteQueue<T> queue(String name,
    int cap,
    CollectionConfiguration cfg)
{
    return null;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:8,
代码来源:IgniteMock.java

示例23: queue

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public <T> IgniteQueue<T> queue(String name, int cap, @Nullable CollectionConfiguration cfg)
    throws IgniteException {
    throwUnsupported();

    return null;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:8,
代码来源:IgfsIgniteMock.java

示例24: collectionConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected CollectionConfiguration collectionConfiguration() {
    CollectionConfiguration colCfg = super.collectionConfiguration();

    if (colCfg.getCacheMode() == PARTITIONED)
        colCfg.setBackups(1);

    return colCfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:10,
代码来源:GridCacheSetAbstractSelfTest.java

示例25: collectionConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected CollectionConfiguration collectionConfiguration() {
    CollectionConfiguration colCfg = super.collectionConfiguration();

    colCfg.setBackups(BACKUP_CNT);

    return colCfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:9,
代码来源:GridCachePartitionedQueueEntryMoveSelfTest.java

示例26: collectionConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected CollectionConfiguration collectionConfiguration() {
    CollectionConfiguration colCfg = super.collectionConfiguration();

    colCfg.setBackups(0);

    return colCfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:9,
代码来源:IgnitePartitionedQueueNoBackupsTest.java

示例27: GetJob

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @param queueName Queue name.
 * @param colCfg Collection configuration.
 * @param retries  Number of operations.
 * @param expVal Expected value.
 */
GetJob(String queueName, CollectionConfiguration colCfg, int retries, String expVal) {
    this.queueName = queueName;
    this.colCfg = colCfg;
    this.retries = retries;
    this.expVal = expVal;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:13,
代码来源:GridCacheQueueMultiNodeAbstractSelfTest.java

示例28: config

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @param collocated Collocated flag.
 * @return Collection configuration.
 */
protected final CollectionConfiguration config(boolean collocated) {
    CollectionConfiguration cfg = collectionConfiguration();

    cfg.setCollocated(collocated);

    return cfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:12,
代码来源:IgniteCollectionAbstractTest.java

示例29: collectionConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @return Collection configuration.
 */
protected CollectionConfiguration collectionConfiguration() {
    CollectionConfiguration colCfg = new CollectionConfiguration();

    colCfg.setCacheMode(collectionCacheMode());
    colCfg.setAtomicityMode(collectionCacheAtomicityMode());
    colCfg.setOffHeapMaxMemory(collectionOffHeapMaxMemory());

    if (colCfg.getCacheMode() == PARTITIONED)
        colCfg.setBackups(1);

    return colCfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:16,
代码来源:IgniteCollectionAbstractTest.java

示例30: collectionConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected CollectionConfiguration collectionConfiguration() {
    CollectionConfiguration colCfg = super.collectionConfiguration();

    colCfg.setBackups(1);

    return colCfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:9,
代码来源:GridCacheAbstractQueueFailoverDataConsistencySelfTest.java

示例31: collectionConfiguration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override protected CollectionConfiguration collectionConfiguration() {
    CollectionConfiguration colCfg = super.collectionConfiguration();

    colCfg.setBackups(backups);

    return colCfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:9,
代码来源:GridCacheQueueMultiNodeConsistencySelfTest.java

示例32: IgniteDexecutorState

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
public IgniteDexecutorState(final String cacheName, final Ignite ignite) {
	CACHE_ID_PHASE = cacheName + "-phase";
	CACHE_ID_GRAPH = cacheName + "-graph";
	CACHE_ID_NODES_COUNT = cacheName + "-nodes-count";
	CACHE_ID_PROCESSED_NODES = cacheName + "-processed-nodes";
	CACHE_ID_DISCONDINUED_NODES = cacheName + "-discontinued-nodes";
	CACHE_ID_ERRORED_NODES = cacheName + "-errored-nodes";
	
	this.distributedCache = ignite.getOrCreateCache(cacheName + "distribute");
	this.distributedCache.put(CACHE_ID_PHASE, Phase.BUILDING);
	
	this.distributedCache.put(CACHE_ID_GRAPH, new DefaultDag<>());
	
	
	
	this.nodesCount = ignite.atomicLong(
			CACHE_ID_NODES_COUNT, // Atomic long name.
		    0,            // Initial value.
		    true         // Create if it does not exist.
		);
	
	CollectionConfiguration setCfg = new CollectionConfiguration();

       setCfg.setAtomicityMode(TRANSACTIONAL);
       setCfg.setCacheMode(PARTITIONED);
	this.processedNodes = ignite.set(
			CACHE_ID_PROCESSED_NODES, // Queue name.
			setCfg       // Collection configuration.
		);
	
	
	this.discontinuedNodes = ignite.set(
			CACHE_ID_DISCONDINUED_NODES, // Queue name.
			setCfg       // Collection configuration.
		);
	
	this.erroredNodes = ignite.set(
			CACHE_ID_ERRORED_NODES, // Queue name.
			setCfg       // Collection configuration.
		);

}
 

开发者ID:dexecutor,
项目名称:dexecutor-ignite,
代码行数:43,
代码来源:IgniteDexecutorState.java

示例33: testOperations2

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testOperations2() {
    for (int i = 0; i < 100; i++) {
        template.requestBody("ignite:set:abc?operation=ADD", "hello" + i);
    }

    // SIZE
    int size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class);
    assert_().that(size).isEqualTo(100);
    assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(100);

    List<String> toRetain = Lists.newArrayList();
    for (int i = 0; i < 50; i++) {
        toRetain.add("hello" + i);
    }

    // RETAIN_ALL
    boolean retained = template.requestBodyAndHeader("ignite:set:abc?operation=CLEAR", toRetain, IgniteConstants.IGNITE_SETS_OPERATION, IgniteSetOperation.RETAIN_ALL, boolean.class);
    assert_().that(retained).isTrue();

    // SIZE
    size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class);
    assert_().that(size).isEqualTo(50);
    assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(50);

    // ITERATOR
    Iterator<String> iterator = template.requestBody("ignite:set:abc?operation=ITERATOR", "hello", Iterator.class);
    assert_().that(Iterators.toArray(iterator, String.class)).asList().containsExactlyElementsIn(toRetain);

    // ARRAY
    String[] array = template.requestBody("ignite:set:abc?operation=ARRAY", "hello", String[].class);
    assert_().that(array).asList().containsExactlyElementsIn(toRetain);

    // CLEAR
    Object result = template.requestBody("ignite:set:abc?operation=CLEAR", "hello", String.class);
    assert_().that(result).isEqualTo("hello");
    assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(0);

    // SIZE
    size = template.requestBody("ignite:set:abc?operation=SIZE", "hello", int.class);
    assert_().that(size).isEqualTo(0);
    assert_().that(ignite().set("abc", new CollectionConfiguration()).size()).isEqualTo(0);
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:45,
代码来源:IgniteSetTest.java

示例34: deleteSets

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@After
public void deleteSets() {
    for (String setName : ImmutableSet.<String> of("abc")) {
        ignite().set(setName, new CollectionConfiguration()).close();
    }
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:7,
代码来源:IgniteSetTest.java

示例35: testOperations2

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testOperations2() {
    for (int i = 0; i < 100; i++) {
        template.requestBody("ignite:queue:abc?operation=ADD", "hello" + i);
    }

    // SIZE
    int size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class);
    assert_().that(size).isEqualTo(100);
    assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(100);

    List<String> toRetain = Lists.newArrayList();
    for (int i = 0; i < 50; i++) {
        toRetain.add("hello" + i);
    }

    // RETAIN_ALL
    boolean retained = template.requestBodyAndHeader("ignite:queue:abc?operation=CLEAR", toRetain, IgniteConstants.IGNITE_QUEUE_OPERATION, IgniteQueueOperation.RETAIN_ALL, boolean.class);
    assert_().that(retained).isTrue();

    // SIZE
    size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class);
    assert_().that(size).isEqualTo(50);
    assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(50);

    // ITERATOR
    Iterator<String> iterator = template.requestBody("ignite:queue:abc?operation=ITERATOR", "hello", Iterator.class);
    assert_().that(Iterators.toArray(iterator, String.class)).asList().containsExactlyElementsIn(toRetain).inOrder();

    // ARRAY
    String[] array = template.requestBody("ignite:queue:abc?operation=ARRAY", "hello", String[].class);
    assert_().that(array).asList().containsExactlyElementsIn(toRetain).inOrder();

    // CLEAR
    Object result = template.requestBody("ignite:queue:abc?operation=CLEAR", "hello", String.class);
    assert_().that(result).isEqualTo("hello");
    assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(0);

    // SIZE
    size = template.requestBody("ignite:queue:abc?operation=SIZE", "hello", int.class);
    assert_().that(size).isEqualTo(0);
    assert_().that(ignite().queue("abc", 0, new CollectionConfiguration()).size()).isEqualTo(0);
}
 

开发者ID:HydAu,
项目名称:Camel,
代码行数:45,
代码来源:IgniteQueueTest.java

示例36: DistributedCollectionMetadata

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @param type Type.
 * @param cfg Collection configuration.
 * @param cacheName Cache name.
 */
public DistributedCollectionMetadata(DataStructureType type, CollectionConfiguration cfg, String cacheName) {
    this.type = type;
    this.cfg = cfg;
    this.cacheName = cacheName;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:11,
代码来源:DistributedCollectionMetadata.java

示例37: configuration

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/**
 * @return Collection configuration.
 */
public CollectionConfiguration configuration() {
    return cfg;
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:7,
代码来源:DistributedCollectionMetadata.java

示例38: readExternal

点赞 2

import org.apache.ignite.configuration.CollectionConfiguration; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
    type = (DataStructureType)in.readObject();
    cfg = (CollectionConfiguration) in.readObject();
    cacheName = (String) in.readObject();
}
 

开发者ID:apache,
项目名称:ignite,
代码行数:7,
代码来源:DistributedCollectionMetadata.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)