@@ -20,10 +20,12 @@ public class ExclusiveDBConnectionPool implements DBConnectionPool {
2020
2121 private class AsyncWorker implements Runnable {
2222 private DBConnection conn_ ;
23+ boolean enableSeqNo = true ;
2324 private final Thread workThread_ ;
2425
25- public AsyncWorker (DBConnection conn ) {
26+ public AsyncWorker (DBConnection conn , boolean enableSeqNo ) {
2627 this .conn_ = conn ;
28+ this .enableSeqNo = enableSeqNo ;
2729 workThread_ = new Thread (this );
2830 workThread_ .start ();
2931 }
@@ -49,7 +51,7 @@ public void run() {
4951 break ;
5052 }
5153 try {
52- task .setDBConnection (conn_ );
54+ task .setDBConnection (conn_ , enableSeqNo );
5355 task .call ();
5456 } catch (InterruptedException e ) {
5557 break ;
@@ -71,10 +73,14 @@ public void run() {
7173 }
7274
7375 public ExclusiveDBConnectionPool (String host , int port , String uid , String pwd , int count , boolean loadBalance , boolean enableHighAvailability ) throws IOException {
74- this (host , port , uid , pwd , count , loadBalance , enableHighAvailability , null , "" ,false , false , false );
76+ this (host , port , uid , pwd , count , loadBalance , enableHighAvailability , null , "" ,false , false , false , true );
7577 }
7678
7779 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 {
7884 if (count <= 0 )
7985 throw new RuntimeException ("The thread count can not be less than 0" );
8086 if (!loadBalance ) {
@@ -90,7 +96,7 @@ public ExclusiveDBConnectionPool(String host, int port, String uid, String pwd,
9096 throw new RuntimeException ("Can't connect to the specified host: " , e );
9197 }
9298
93- workers_ .add (new AsyncWorker (conn ));
99+ workers_ .add (new AsyncWorker (conn , enableSeqNo ));
94100 }
95101 } else {
96102 BasicStringVector nodes = null ;
@@ -117,7 +123,7 @@ public ExclusiveDBConnectionPool(String host, int port, String uid, String pwd,
117123 DBConnection conn = new DBConnection (false , useSSL , compress , usePython );
118124 if (!conn .connect (hosts [i % nodeCount ], ports [i % nodeCount ], uid , pwd , initialScript , enableHighAvailability , highAvailabilitySites ,false ,false ))
119125 throw new RuntimeException ("Can't connect to the host " + nodes .getString (i ));
120- workers_ .add (new AsyncWorker (conn ));
126+ workers_ .add (new AsyncWorker (conn , enableSeqNo ));
121127 }
122128 }
123129 }
0 commit comments