* @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.");