修正代码错误

This commit is contained in:
inrgihc
2024-01-14 17:52:27 +08:00
parent ce9b019ac4
commit 8a107da4c3
3 changed files with 6 additions and 16 deletions

View File

@@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionStatus;
/**
@@ -119,14 +118,13 @@ public class DefaultTableDataSynchronizeProvider
throw ex;
}
}
} else {
throw e;
}
}
tx.commit(status);
return records.size();
} catch (TransactionException e) {
tx.rollback(status);
throw e;
} catch (Exception e) {
tx.rollback(status);
throw e;
@@ -173,14 +171,13 @@ public class DefaultTableDataSynchronizeProvider
throw ex;
}
}
} else {
throw e;
}
}
tx.commit(status);
return dataLists.size();
} catch (TransactionException e) {
tx.rollback(status);
throw e;
} catch (Exception e) {
tx.rollback(status);
throw e;
@@ -209,9 +206,6 @@ public class DefaultTableDataSynchronizeProvider
jdbcTemplate.batchUpdate(this.deleteStatementSql, dataLists, this.deleteArgsType);
tx.commit(status);
return dataLists.size();
} catch (TransactionException e) {
tx.rollback(status);
throw e;
} catch (Exception e) {
tx.rollback(status);
throw e;

View File

@@ -10,7 +10,6 @@
package com.gitee.dbswitch.provider.write;
import com.gitee.dbswitch.common.type.ProductTypeEnum;
import com.gitee.dbswitch.common.util.ObjectCastUtils;
import com.gitee.dbswitch.provider.AbstractCommonProvider;
import com.gitee.dbswitch.provider.ProductFactoryProvider;
import java.util.Collections;
@@ -21,7 +20,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionStatus;
@Slf4j
@@ -86,9 +84,6 @@ public class DefaultTableDataWriteProvider
log.debug("{} insert data affect count: {}", getProductType(), affectCount);
}
return affectCount;
} catch (TransactionException e) {
tx.rollback(status);
throw e;
} catch (Exception e) {
tx.rollback(status);
throw e;

View File

@@ -43,7 +43,8 @@ public class WriterTaskThread extends TaskProcessor<WriterTaskResult> {
try {
BatchElement elem;
while ((elem = memChannel.poll()) != null || robotReader.getRemainingCount() > 0) {
while (!memChannel.isEmpty() || robotReader.getRemainingCount() > 0) {
elem = memChannel.poll();
if (Thread.currentThread().isInterrupted()) {
break;
}