Package jp.freeex.us.fourtypes.shared

Examples of jp.freeex.us.fourtypes.shared.Summary


   */
  @Override
  public void execute() {
    long elapse = System.currentTimeMillis();
    log.info("[SummaryCronService#execute()] start");
    Summary sum = StatisticsManager.getInstance().getSummary();
    if(sum==null){
      log.info("[SummaryCronService#execute()] no-summary/end: " +
          (System.currentTimeMillis() - elapse) + "mSec.");
      return;
    }
View Full Code Here


   * @return サマリ
   */
  private Summary retrieveSummary(){
    long elapse = System.currentTimeMillis();
    log.info("[StatisticsManager#retrieveSummary()] start");
    Summary summary = null;
    PersistenceManagerFactory pmf = PMF.get();
    PersistenceManager pm = null;
    try{
      pm = pmf.getPersistenceManager();
      Transaction tx = pm.currentTransaction();
      try{
        tx.begin();
        summary =
            pm.getObjectById(Summary.class, Summary.DBKEY_SUMMARY);
        log.info("[StatisticsManager#retrieveSummary()] got from " +
            "database: " + summary);
        tx.commit();
      }catch(Exception e){
        log.log(Level.INFO,
            "[StatisticsManager#retrieveSummary()] exception " +
            "during getting summary", e);
        if(tx!=null && tx.isActive()) tx.rollback();
        summary = null;
      }
    }finally{
      if(pm!=null){
        pm.close();
      }
    }
   
    // データベース上に集計結果がない場合
    if(summary==null){
      // 0件の集計結果をとりあえずデータベースへ保存する
      summary = new Summary();
      log.info("[StatisticsManager#retrieveSummary()] create new " +
          "summary: " + summary);
    }
    log.info("[StatisticsManager#retrieveSummary()] end: " +
        (System.currentTimeMillis() - elapse) + "mSec.");
View Full Code Here

    log.info("[StatisticsManager#setResult()] (x,y)=(" + x +", " + y +")");
    // キャッシュ取得
    Cache cache =
        CacheManager.getInstance().getCache(C_NAME);
    // 集計結果キャッシュを加算
    Summary summary = (Summary) cache.get(C_KEY_SUMMARY);
    log.info("[StatisticsManager#setResult()] got summary from cache: " +
        summary);
    if(summary == null){
      summary = new Summary();
      log.info("[StatisticsManager#setResult()] summary(cache) is null " +
          "/create new summary: " + summary.toString());
    }
   
    summary = Utils.add(x, y, evaluatedAt, summary);
    log.info("[StatisticsManager#setResult()] count up summary: " +
        summary.toString());
    cache.put(C_KEY_SUMMARY, summary);

    // 結果キャッシュを更新
    Results results =
        (Results) cache.get(C_KEY_RESULTS);
View Full Code Here

  public Summary getSummary(){
    long elapse = System.currentTimeMillis();
    log.info("[StatisticsManager#getSummary()] start");
    Cache cache =
        CacheManager.getInstance().getCache(C_NAME);
    Summary summary = (Summary)cache.get(C_KEY_SUMMARY);
    log.info("[StatisticsManager#getSummary()] got summary from cache: " +
        summary);
    if(summary == null){
      summary = new Summary();
      log.info("[StatisticsManager#getSummary()] no summary cache/create:"
          + summary.toString());
      cache.put(C_KEY_SUMMARY, summary);
      log.info("[StatisticsManager#getSummary()] update summary cache: " +
          summary.toString());
    }
    log.info("[StatisticsManager#getSummary()] end: " +
        (System.currentTimeMillis() - elapse) + "mSec.");
    return summary;
  }
View Full Code Here

TOP

Related Classes of jp.freeex.us.fourtypes.shared.Summary

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.