Skip to content

Commit 6582b41

Browse files
author
chengyitian
committed
Revert "JAVAOS-1340: support 'enableSeqNo' for MTW、ExclusiveDBConnectionPool; add 'setDBConnection(DBConnection conn, boolean enableSeqNo)' for DBTask;"
This reverts commit 7682f66.
1 parent 7682f66 commit 6582b41

4 files changed

Lines changed: 30 additions & 68 deletions

File tree

src/com/xxdb/BasicDBTask.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
public class BasicDBTask implements DBTask {
1111
private String script;
12-
private boolean enableSeqNo = true;
1312
private List<Entity> args;
1413
private DBConnection conn;
1514
private Entity result = null;
@@ -18,9 +17,6 @@ public class BasicDBTask implements DBTask {
1817
private CountDownLatch latch;
1918
private int timeOut = -1;
2019

21-
private static final int DEFAULT_PRIORITY = 4;
22-
private static final int DEFAULT_PARALLELISM = 64;
23-
2420
public BasicDBTask(String script, List<Entity> args) {
2521
this.script = script;
2622
this.args = args;
@@ -34,12 +30,10 @@ public BasicDBTask(String script) {
3430
@Override
3531
public Entity call() {
3632
try {
37-
if (args != null) {
38-
result = conn.run(script, args, DEFAULT_PRIORITY, DEFAULT_PARALLELISM, 0, enableSeqNo);
39-
} else {
40-
result = conn.run(script, null, DEFAULT_PRIORITY, DEFAULT_PARALLELISM, 0, false, "", enableSeqNo);
41-
}
42-
33+
if (args != null)
34+
result = conn.run(script, args);
35+
else
36+
result = conn.run(script);
4337
errMsg = null;
4438
synchronized (this) {
4539
status = TaskStatus.SUCCESS;
@@ -61,12 +55,6 @@ public void setDBConnection(DBConnection conn) {
6155
this.conn = conn;
6256
}
6357

64-
@Override
65-
public void setDBConnection(DBConnection conn, boolean enableSeqNo) {
66-
this.conn = conn;
67-
this.enableSeqNo = enableSeqNo;
68-
}
69-
7058
@Override
7159
public Entity getResult() {
7260
if (status != TaskStatus.SUCCESS) {

src/com/xxdb/DBTask.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
public interface DBTask extends Callable<Entity>{
77
void setDBConnection(DBConnection conn);
8-
void setDBConnection(DBConnection conn, boolean enableSeqNo);
98
Entity getResult();
109
String getErrorMsg();
1110
String getScript();

src/com/xxdb/ExclusiveDBConnectionPool.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ public class ExclusiveDBConnectionPool implements DBConnectionPool {
2020

2121
private class AsyncWorker implements Runnable {
2222
private DBConnection conn_;
23-
boolean enableSeqNo = true;
2423
private final Thread workThread_;
2524

26-
public AsyncWorker(DBConnection conn, boolean enableSeqNo) {
25+
public AsyncWorker(DBConnection conn) {
2726
this.conn_ = conn;
28-
this.enableSeqNo = enableSeqNo;
2927
workThread_ = new Thread(this);
3028
workThread_.start();
3129
}
@@ -51,7 +49,7 @@ public void run() {
5149
break;
5250
}
5351
try {
54-
task.setDBConnection(conn_, enableSeqNo);
52+
task.setDBConnection(conn_);
5553
task.call();
5654
} catch (InterruptedException e) {
5755
break;
@@ -73,14 +71,10 @@ public void run() {
7371
}
7472

7573
public ExclusiveDBConnectionPool(String host, int port, String uid, String pwd, int count, boolean loadBalance, boolean enableHighAvailability) throws IOException {
76-
this(host, port, uid, pwd, count, loadBalance, enableHighAvailability, null, "",false, false, false, true);
74+
this(host, port, uid, pwd, count, loadBalance, enableHighAvailability, null, "",false, false, false);
7775
}
7876

7977
public ExclusiveDBConnectionPool(String host, int port, String uid, String pwd, int count, boolean loadBalance, boolean enableHighAvailability, String[] highAvailabilitySites, String initialScript,boolean compress, boolean useSSL, boolean usePython) throws IOException {
80-
this(host, port, uid, pwd, count, loadBalance, enableHighAvailability, highAvailabilitySites, initialScript, compress, useSSL, usePython, true);
81-
}
82-
83-
public ExclusiveDBConnectionPool(String host, int port, String uid, String pwd, int count, boolean loadBalance, boolean enableHighAvailability, String[] highAvailabilitySites, String initialScript,boolean compress, boolean useSSL, boolean usePython, boolean enableSeqNo) throws IOException {
8478
if (count <= 0)
8579
throw new RuntimeException("The thread count can not be less than 0");
8680
if (!loadBalance) {
@@ -96,7 +90,7 @@ public ExclusiveDBConnectionPool(String host, int port, String uid, String pwd,
9690
throw new RuntimeException("Can't connect to the specified host: ", e);
9791
}
9892

99-
workers_.add(new AsyncWorker(conn, enableSeqNo));
93+
workers_.add(new AsyncWorker(conn));
10094
}
10195
} else {
10296
BasicStringVector nodes = null;
@@ -123,7 +117,7 @@ public ExclusiveDBConnectionPool(String host, int port, String uid, String pwd,
123117
DBConnection conn = new DBConnection(false, useSSL, compress, usePython);
124118
if(!conn.connect(hosts[i % nodeCount], ports[i % nodeCount], uid, pwd, initialScript, enableHighAvailability, highAvailabilitySites,false,false))
125119
throw new RuntimeException("Can't connect to the host " + nodes.getString(i));
126-
workers_.add(new AsyncWorker(conn, enableSeqNo));
120+
workers_.add(new AsyncWorker(conn));
127121
}
128122
}
129123
}

0 commit comments

Comments
 (0)