---
title: "try cathc finally 代码优化"
author: "rainyear"
date: "2011-11-30T22:21:06Z"
tags: []
categories: ["非技术"]
slug: "try-cathc-finally"
draft: false
lastmod: "2011-11-30T22:21:06Z"
id: 1286350
url: "https://rainyear.iteye.com/blog/1286350"
---

boolean sucess=false;//业务处理成功标志
try{
.....
sucess=true；
......
 ...}
catch....
finally{
   if(secess)iGoodCenterPushService.publishCMSandGPCQNMQ(iGoodCenterPushBeans);

}
 
OffPublishGoodsTaskCmdImpl.performExecute()代码有问题：
try{
 ...}
catch....

iGoodCenterPushService.publishCMSandGPCQNMQ(iGoodCenterPushBeans);