示例#1
0
 /**
  * This is final since you should override saveInCacheInsideExistingTransaction instead, generally
  */
 @TransactionAttribute(TransactionAttributeType.NEVER)
 public final ResultType saveInCache(
     final KeyType key, final ResultType data, final boolean refetchedWithoutCheckingCache) {
   EJBUtil.assertNoTransaction();
   try {
     return runner.runTaskRetryingOnConstraintViolation(
         new Callable<ResultType>() {
           public ResultType call() {
             return saveInCacheInsideExistingTransaction(
                 key, data, new Date(), refetchedWithoutCheckingCache);
           }
         });
   } catch (Exception e) {
     if (EJBUtil.isDatabaseException(e)) {
       logger.warn("Ignoring database exception {}: {}", e.getClass().getName(), e.getMessage());
       return data;
     } else {
       ExceptionUtils.throwAsRuntimeException(e);
       throw new RuntimeException(e); // not reached
     }
   }
 }
示例#2
0
 @TransactionAttribute(TransactionAttributeType.NEVER)
 public ResultType fetchFromNet(KeyType key) {
   EJBUtil.assertNoTransaction();
   return fetchFromNetImpl(key);
 }