diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/src/sync/BasicSyncTask.java | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/main/src/sync/BasicSyncTask.java b/src/main/src/sync/BasicSyncTask.java index 24f34a8..35f3b63 100644 --- a/src/main/src/sync/BasicSyncTask.java +++ b/src/main/src/sync/BasicSyncTask.java @@ -112,7 +112,7 @@ public class BasicSyncTask extends AbstractSyncTask { Iterator<MVDataEntry> itSrc = srcReader.iterator(); Iterator<MVDataEntry> itDst = dstReader.iterator(); - MVDataEntry src = null, dst = null; + MVDataEntry srcData = null, dstData = null; boolean srcExhausted = false; boolean dstExhausted = false; boolean abort = false; @@ -120,14 +120,14 @@ public class BasicSyncTask extends AbstractSyncTask { while ( !abort && !done ) { // Look-ahead srcReader if previous has been "poped" (or if never read yet) - if ( src == null ) { + if ( srcData == null ) { if ( !srcExhausted ) { srcExhausted = !itSrc.hasNext(); } if ( !srcExhausted ) { try { - src=itSrc.next(); - logger.trace("src read : " + src); + srcData=itSrc.next(); + logger.trace("src read : " + srcData); } catch (Exception e) { logger.error("Read failure detected on " + srcReader.getDataSourceName() + ". Aborting.", e); // Escape from the while loop @@ -137,14 +137,14 @@ public class BasicSyncTask extends AbstractSyncTask { } // Look-ahead dstReader if previous has been "poped" (or if never read yet) - if ( dst == null ) { + if ( dstData == null ) { if ( !dstExhausted ) { dstExhausted = !itDst.hasNext(); } if ( !dstExhausted ) { try { - dst = itDst.next(); - logger.trace("dst read : " + dst); + dstData = itDst.next(); + logger.trace("dst read : " + dstData); } catch (NoSuchElementException e) { logger.error("Read failure detected on " + dstReader.getDataSourceName() + ". Aborting.", e); // Escape from the while loop @@ -157,7 +157,7 @@ public class BasicSyncTask extends AbstractSyncTask { int compare; if ( !srcExhausted && !dstExhausted ) { // General case : check order precedence to take an action - compare = src.compareTo(dst); + compare = srcData.compareTo(dstData); } else if ( !srcExhausted && dstExhausted ) { // Particular case : dst is exhausted, it's like ( src < dst ) compare=-1; @@ -175,26 +175,26 @@ public class BasicSyncTask extends AbstractSyncTask { boolean actionRealized = false; // Take an action (insert/update/delete) if ( compare < 0 ) { - actionRealized = _insert(src); - src = null; + actionRealized = _insert(srcData); + srcData = null; // preserve dst until src key is not greater } else if ( compare > 0 ) { // dst current entry doesn't exists anymore (src key is greater than dst key) - actionRealized = _delete(dst); + actionRealized = _delete(dstData); // preserve src until dst key is not greater - dst = null; + dstData = null; } else /* ( compare == 0 ) */ { // src current entry already exists in dst, update it if necessary - Set<String> changedAttr = src.getChangedAttributes(dst); + Set<String> changedAttr = srcData.getChangedAttributes(dstData); if ( ! changedAttr.isEmpty() ) { - actionRealized = _update(src,dst,changedAttr); + actionRealized = _update(srcData,dstData,changedAttr); } else { // Already up-to-date, nothing to do actionRealized = true; } // Both src and dst have been used - src = null; - dst = null; + srcData = null; + dstData = null; } abort = !actionRealized; } /* while */ |