Skip to content

Commit a4a53a3

Browse files
author
chengyitian
committed
AJ-830: optimize run function with listener method;
1 parent bbddbb5 commit a4a53a3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/com/xxdb/DBConnection.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ public class DBConnection {
5656
private boolean isReverseStreaming_ = false;
5757
private int tryReconnectNums = -1;
5858

59-
private ProgressListener _listener;
60-
61-
public void set_listener(ProgressListener _listener) {
62-
this._listener = _listener;
63-
}
64-
6559
private static final Logger log = LoggerFactory.getLogger(DBConnection.class);
6660

6761
private enum ExceptionType{
@@ -1352,6 +1346,10 @@ private long newSeqNo(){
13521346
}
13531347

13541348
public Entity run(String function, List<Entity> arguments, int priority, int parallelism, int fetchSize, boolean enableSeqNo) throws IOException {
1349+
return run(function, arguments, priority, parallelism, fetchSize, enableSeqNo, null);
1350+
}
1351+
1352+
public Entity run(String function, List<Entity> arguments, int priority, int parallelism, int fetchSize, boolean enableSeqNo, ProgressListener listener) throws IOException {
13551353
mutex_.lock();
13561354
try {
13571355
if (!nodes_.isEmpty()) {
@@ -1363,7 +1361,7 @@ public Entity run(String function, List<Entity> arguments, int priority, int par
13631361

13641362
while (!closed_) {
13651363
try {
1366-
return conn_.run(function, this._listener == null?null:this._listener, arguments, priority, parallelism, fetchSize, false, currentSeqNo);
1364+
return conn_.run(function, listener, arguments, priority, parallelism, fetchSize, false, currentSeqNo);
13671365
} catch (IOException e) {
13681366
if (currentSeqNo > 0)
13691367
currentSeqNo = -currentSeqNo;
@@ -1382,7 +1380,7 @@ else if (type == ExceptionType.ET_UNKNOW)
13821380
}
13831381
return null;
13841382
} else {
1385-
return conn_.run(function, this._listener==null?null:this._listener, arguments, priority, parallelism, fetchSize, false, 0);
1383+
return conn_.run(function, listener, arguments, priority, parallelism, fetchSize, false, 0);
13861384
}
13871385
} finally {
13881386
mutex_.unlock();

0 commit comments

Comments
 (0)