コード例 #1
0
ファイル: DumbWorker.java プロジェクト: caricah/iotracah
  /**
   * <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);
  }
  /** {@inheritDoc} */
  @Override
  protected CacheConfiguration cacheConfiguration() {
    CacheConfiguration ccfg = super.cacheConfiguration();

    ccfg.setCacheMode(CacheMode.REPLICATED);
    ccfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
    ccfg.setOffHeapMaxMemory(0);

    return ccfg;
  }