Commit 4fdbb3fb authored by Quxl's avatar Quxl

x

parent 28c94434
...@@ -34,10 +34,10 @@ import com.egolm.sentinel.config.XRException; ...@@ -34,10 +34,10 @@ import com.egolm.sentinel.config.XRException;
public class SqlConcurrentController { public class SqlConcurrentController {
@PostMapping("concurrentSql") @PostMapping("concurrentSql")
public Rjx doExecute(String jdbcUrl, String username, String password, String sql, String parameters, Integer threadCount, Integer executeCount, Integer isOpenTx) throws InterruptedException, IOException, SQLException { public Rjx doExecute(String jdbcUrl, String username, String password, String sql, String parameters, Integer threadCount, Integer executeCount, Boolean isOpenTx) throws InterruptedException, IOException, SQLException {
threadCount = threadCount == null ? 1 : threadCount; threadCount = threadCount == null ? 1 : threadCount;
executeCount = executeCount == null ? 1 : executeCount; executeCount = executeCount == null ? 1 : executeCount;
isOpenTx = isOpenTx == null ? 0 : isOpenTx; isOpenTx = isOpenTx == null ? false : isOpenTx;
ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount, 5, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(executeCount)); ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount, 5, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(executeCount));
CountDownLatch latch = new CountDownLatch(executeCount); CountDownLatch latch = new CountDownLatch(executeCount);
...@@ -46,7 +46,7 @@ public class SqlConcurrentController { ...@@ -46,7 +46,7 @@ public class SqlConcurrentController {
try { try {
dataSource = this.getDataSource(jdbcUrl, username, password); dataSource = this.getDataSource(jdbcUrl, username, password);
TransactionTemplate txTemplate = null; TransactionTemplate txTemplate = null;
if(isOpenTx.intValue() == 1) { if(isOpenTx) {
DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource); DataSourceTransactionManager txManager = new DataSourceTransactionManager(dataSource);
txTemplate = new TransactionTemplate(txManager); txTemplate = new TransactionTemplate(txManager);
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<el-input size="mini" placeholder="参数" v-model="form.parameters" style="width:300px;"></el-input> <el-input size="mini" placeholder="参数" v-model="form.parameters" style="width:300px;"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-input size="mini" placeholder="参数" v-model="form.parameters" style="width:300px;"></el-input> <el-checkbox v-model="form.isOpenTx">开启事务</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="mini" type="primary" @click="doExecute">执行</el-button> <el-button size="mini" type="primary" @click="doExecute">执行</el-button>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment