同步关键字,解决迁移失败的问题

web_backend_develope
chenlw 8 years ago
parent d6f1009455
commit 32bd1be861

@ -38,8 +38,6 @@ public class ThreadMoveData{
public final static Logger log = Logger.getLogger(ThreadMoveData.class); public final static Logger log = Logger.getLogger(ThreadMoveData.class);
private static boolean iscontinue = false;
@Resource(name = "dataInfoDao") @Resource(name = "dataInfoDao")
private DataInfoDao dataInfoDao; private DataInfoDao dataInfoDao;
@ -71,38 +69,35 @@ public class ThreadMoveData{
} }
//迁移数据 -- 2016-11-30后 使用 //迁移数据 -- 2016-11-30后 使用
@Scheduled(fixedDelay = 4000) @Scheduled(fixedDelay = 5000)
public void moveDataByWebGfs(){ public void moveDataByWebGfs(){
if (iscontinue) { synchronized(this){
return; List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
} Map<String, String> volumeMap = new HashMap<String, String>();
iscontinue = true; try {
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>(); List<VolumeInitEntity> volumeList = volumeDao.findAll();
Map<String, String> volumeMap = new HashMap<String, String>(); for (VolumeInitEntity volumeInitEntity : volumeList) {
try { volumeMap.put(volumeInitEntity.getPath(), volumeInitEntity.getMark());
List<VolumeInitEntity> volumeList = volumeDao.findAll(); }
for (VolumeInitEntity volumeInitEntity : volumeList) { } catch (Exception e1) {
volumeMap.put(volumeInitEntity.getPath(), volumeInitEntity.getMark()); log.error(e1);
} }
} catch (Exception e1) { try {
log.error(e1); result = dataInfoMoveTmpDao.findAll();
} } catch (Exception e) {
try { log.error(e);
result = dataInfoMoveTmpDao.findAll(); }
} catch (Exception e) { try {
log.error(e); List<DataInfoEntityMoveTmp> insertData = this.doMoveService(result);
} if (insertData.size() > 0) {
try { for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : insertData) {
List<DataInfoEntityMoveTmp> insertData = this.doMoveService(result); this.makeDataInfo(dataInfoEntityMoveTmp, volumeMap);
if (insertData.size() > 0) { }
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : insertData) {
this.makeDataInfo(dataInfoEntityMoveTmp, volumeMap);
} }
} catch (Exception e) {
log.error(e);
} }
} catch (Exception e) {
log.error(e);
} }
iscontinue = false;
} }
//5秒 //2016-11-30后 不使用 //5秒 //2016-11-30后 不使用

Loading…
Cancel
Save