diff --git a/src/com/platform/service/thread/ThreadMoveData.java b/src/com/platform/service/thread/ThreadMoveData.java index 63728914..414e3ed6 100644 --- a/src/com/platform/service/thread/ThreadMoveData.java +++ b/src/com/platform/service/thread/ThreadMoveData.java @@ -38,8 +38,6 @@ public class ThreadMoveData{ public final static Logger log = Logger.getLogger(ThreadMoveData.class); - private static boolean iscontinue = false; - @Resource(name = "dataInfoDao") private DataInfoDao dataInfoDao; @@ -71,38 +69,35 @@ public class ThreadMoveData{ } //迁移数据 -- 2016-11-30后 使用 - @Scheduled(fixedDelay = 4000) + @Scheduled(fixedDelay = 5000) public void moveDataByWebGfs(){ - if (iscontinue) { - return; - } - iscontinue = true; - List result = new ArrayList(); - Map volumeMap = new HashMap(); - try { - List volumeList = volumeDao.findAll(); - for (VolumeInitEntity volumeInitEntity : volumeList) { - volumeMap.put(volumeInitEntity.getPath(), volumeInitEntity.getMark()); + synchronized(this){ + List result = new ArrayList(); + Map volumeMap = new HashMap(); + try { + List volumeList = volumeDao.findAll(); + for (VolumeInitEntity volumeInitEntity : volumeList) { + volumeMap.put(volumeInitEntity.getPath(), volumeInitEntity.getMark()); + } + } catch (Exception e1) { + log.error(e1); } - } catch (Exception e1) { - log.error(e1); - } - try { - result = dataInfoMoveTmpDao.findAll(); - } catch (Exception e) { - log.error(e); - } - try { - List insertData = this.doMoveService(result); - if (insertData.size() > 0) { - for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : insertData) { - this.makeDataInfo(dataInfoEntityMoveTmp, volumeMap); + try { + result = dataInfoMoveTmpDao.findAll(); + } catch (Exception e) { + log.error(e); + } + try { + List insertData = this.doMoveService(result); + 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后 不使用