예제 #1
0
  /**
   * <code>initiate</code> starts the operations of this system handler. All excecution code for the
   * plugins is expected to begin at this point.
   *
   * @throws UnRetriableException
   */
  @Override
  public void initiate() throws UnRetriableException {

    // Initiate the session reset manager.
    SessionResetManager sessionResetManager = new SessionResetManager();
    sessionResetManager.setWorker(this);
    sessionResetManager.setDatastore(this.getDatastore());
    setSessionResetManager(sessionResetManager);

    String igniteCacheName = "dumbTester";

    CacheConfiguration clCfg = new CacheConfiguration();

    clCfg.setName(igniteCacheName);
    clCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    clCfg.setCacheMode(CacheMode.PARTITIONED);
    clCfg.setMemoryMode(CacheMemoryMode.ONHEAP_TIERED);

    LruEvictionPolicy lruEvictionPolicy = new LruEvictionPolicy(5170000);
    clCfg.setEvictionPolicy(lruEvictionPolicy);

    clCfg.setSwapEnabled(true);

    // if(subscriptions instanceof  IgniteCache) {
    // subscriptions = getIgnite().createCache(clCfg);
    // }

    // Initiate unirest properties.
    Unirest.setTimeouts(5000, 5000);
  }
  /**
   * @param gridName Grid name.
   * @return Cache configuration.
   * @throws Exception In case of error.
   */
  @SuppressWarnings("unchecked")
  protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
    CacheConfiguration cfg = defaultCacheConfiguration();

    CacheStore<?, ?> store = cacheStore();

    if (store != null) {
      cfg.setCacheStoreFactory(new TestStoreFactory());
      cfg.setReadThrough(true);
      cfg.setWriteThrough(true);
      cfg.setLoadPreviousValue(true);
    }

    cfg.setSwapEnabled(swapEnabled());
    cfg.setCacheMode(cacheMode());
    cfg.setAtomicityMode(atomicityMode());
    cfg.setWriteSynchronizationMode(writeSynchronization());
    cfg.setNearConfiguration(nearConfiguration());

    Class<?>[] idxTypes = indexedTypes();

    if (!F.isEmpty(idxTypes)) cfg.setIndexedTypes(idxTypes);

    if (cacheMode() == PARTITIONED) cfg.setBackups(1);

    return cfg;
  }
예제 #3
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(gridName);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

    // Cache.
    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(CacheMode.PARTITIONED);
    cc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
    cc.setNearConfiguration(null);
    cc.setWriteSynchronizationMode(FULL_SYNC);
    cc.setRebalanceMode(SYNC);
    cc.setSwapEnabled(false);
    cc.setSqlFunctionClasses(GridQueryParsingTest.class);
    cc.setIndexedTypes(
        String.class, Address.class,
        String.class, Person.class);

    c.setCacheConfiguration(cc);

    return c;
  }
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(gridName);

    TransactionConfiguration txCfg = c.getTransactionConfiguration();

    txCfg.setDefaultTxConcurrency(txConcurrency);
    txCfg.setDefaultTxIsolation(txIsolation);
    txCfg.setTxSerializableEnabled(true);

    CacheConfiguration cc = defaultCacheConfiguration();

    cc.setCacheMode(cacheMode());
    cc.setAtomicityMode(TRANSACTIONAL);

    cc.setSwapEnabled(false);

    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);

    cc.setEvictionPolicy(plc);
    cc.setEvictSynchronizedKeyBufferSize(1);

    cc.setEvictSynchronized(true);

    if (testStore != null) {
      cc.setCacheStoreFactory(singletonFactory(testStore));
      cc.setReadThrough(true);
      cc.setWriteThrough(true);
      cc.setLoadPreviousValue(true);
    } else cc.setCacheStoreFactory(null);

    c.setCacheConfiguration(cc);

    TcpDiscoverySpi disco = new TcpDiscoverySpi();

    disco.setIpFinder(ipFinder);

    c.setDiscoverySpi(disco);

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

    TcpDiscoverySpi spi = new TcpDiscoverySpi();

    spi.setIpFinder(IP_FINDER);

    cfg.setDiscoverySpi(spi);

    cfg.setIncludeProperties();

    cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);

    cfg.setConnectorConfiguration(null);

    cfg.setPeerClassLoadingEnabled(true);

    if (useCache) {
      CacheConfiguration cc = defaultCacheConfiguration();

      cc.setCacheMode(PARTITIONED);

      cc.setNearConfiguration(null);
      cc.setWriteSynchronizationMode(FULL_SYNC);
      cc.setStartSize(ENTRY_CNT / GRID_CNT);
      cc.setSwapEnabled(false);

      cc.setBackups(1);

      cfg.setCacheSanityCheckEnabled(false);
      cfg.setCacheConfiguration(cc);
    } else cfg.setCacheConfiguration();

    return cfg;
  }