Skip to content

Commit

Permalink
优化cache插件效率;
Browse files Browse the repository at this point in the history
  • Loading branch information
sasou2008 committed Jan 24, 2019
1 parent 2737fe5 commit d3dc507
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
Binary file modified bin/syncClient.jar
Binary file not shown.
31 changes: 16 additions & 15 deletions src/src/com/sync/process/Cache.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,24 +124,25 @@ private boolean syncEntry(List<Entry> entrys) {
updateColumn(versionField, rowData.getBeforeColumnsList(), table);
updateColumn(versionField, rowData.getAfterColumnsList(), table);
}
String text = JSON.toJSONString(versionField);
try {
Iterator<String> iterator = versionField.iterator();
while (iterator.hasNext()) {
if("redis".equals(GetProperties.target.get(canal_destination).plugin)) {
RedisPool.incr(sign + Tool.md5(iterator.next()));
}
if("memcached".equals(GetProperties.target.get(canal_destination).plugin)) {
MemPool.incr(sign + Tool.md5(iterator.next()));
}
}

try {
Iterator<String> iterator = versionField.iterator();
while (iterator.hasNext()) {
if("redis".equals(GetProperties.target.get(canal_destination).plugin)) {
RedisPool.incr(sign + Tool.md5(iterator.next()));
}
if (GetProperties.system_debug > 0) {
WriteLog.write(canal_destination + ".access", thread_name + "data(" + text + ")");
if("memcached".equals(GetProperties.target.get(canal_destination).plugin)) {
MemPool.incr(sign + Tool.md5(iterator.next()));
}
} catch (Exception e) {
WriteLog.write(canal_destination + ".error", thread_name + "redis link failure!" + WriteLog.eString(e));
ret = false;
}
if (GetProperties.system_debug > 0) {
String text = JSON.toJSONString(versionField);
WriteLog.write(canal_destination + ".access", thread_name + "data(" + text + ")");
}
} catch (Exception e) {
WriteLog.write(canal_destination + ".error", thread_name + "cache link failure!" + WriteLog.eString(e));
ret = false;
}
versionField.clear();
versionField = null;
Expand Down

0 comments on commit d3dc507

Please sign in to comment.