Browse Source

NumberValue 字符串转换 和oracl EMPTY_BLOB类型问题

pengshengdong 5 months ago
parent
commit
915778095b

+ 17 - 16
dbsyncer-connector/dbsyncer-connector-oracle/src/main/java/org/dbsyncer/connector/oracle/logminer/LogMiner.java

@@ -134,33 +134,34 @@ public class LogMiner {
 
                 // 7.确定新的SCN
                 startScn = Long.parseLong(endScn.toString());
-
-                try {
-                    // 避免频繁的执行导致 PGA 内存超出 PGA_AGGREGATE_LIMIT
-                    TimeUnit.SECONDS.sleep(5);
-                } catch (InterruptedException e) {
-                    logger.error(e.getMessage(), e);
-                }
+                sleepFiveSeconds();
             }
 
         } catch (Exception e) {
             if (e instanceof SQLRecoverableException) {
-                //避免频繁重连 间隔5s 连接一次TimeUnit.sEcoNDs.sleep( timeout: 5);
                 logger.error("Connection timed out, attempting to reconnect in 5 seconds");
-                connected = false;
-                try {
-                    // 避免频繁的执行导致
-                    TimeUnit.SECONDS.sleep(5);
-                    start();
-                } catch (InterruptedException interruptedException) {
-                    logger.error(e.getMessage(), interruptedException);
-                }
+                reConnection();
                 return;
             }
             logger.error(e.getMessage(), e);
         }
     }
 
+
+    private void reConnection() throws SQLException {
+        connected = false;
+        sleepFiveSeconds();
+        start();
+    }
+
+    private void sleepFiveSeconds() {
+        try {
+            TimeUnit.SECONDS.sleep(5);
+        } catch (InterruptedException interruptedException) {
+            logger.error(interruptedException.getMessage(), interruptedException);
+        }
+    }
+
     public long getCurrentScn(Connection connection) throws SQLException {
         try (Statement statement = connection.createStatement()) {
             ResultSet rs = statement.executeQuery("select CURRENT_SCN from V$DATABASE");