Skip to content

Commit f0683d1

Browse files
author
chengyitian
committed
AJ-437: deprecate DBConnection's isReverseStreaming param.
1 parent 5164b50 commit f0683d1

File tree

2 files changed

+35
-5
lines changed

2 files changed

+35
-5
lines changed

src/com/xxdb/DBConnection.java

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,18 @@ private DBConnectionImpl(boolean asynTask, boolean sslEnable, boolean compress,
177177
this.lock_ = new ReentrantLock();
178178
}
179179

180+
private DBConnectionImpl(boolean asynTask, boolean sslEnable, boolean compress, boolean python, boolean ifUrgent, SqlStdEnum sqlStd){
181+
sessionID_ = "";
182+
this.sslEnable_ = sslEnable;
183+
this.asynTask_ = asynTask;
184+
this.compress_ = compress;
185+
this.ifUrgent_ = ifUrgent;
186+
this.python_ = python;
187+
this.isReverseStreaming_ = false;
188+
this.sqlStd_ = sqlStd;
189+
this.lock_ = new ReentrantLock();
190+
}
191+
180192
private boolean connect(String hostName, int port, String userId, String password, int connTimeout) throws IOException{
181193
this.hostName_ = hostName;
182194
this.port_ = port;
@@ -572,12 +584,16 @@ public ExtendedDataInput getDataInputStream() {
572584
}
573585
}
574586

587+
private DBConnectionImpl createEnableReverseStreamingDBConnectionImpl(boolean asynTask, boolean sslEnable, boolean compress, boolean python, boolean ifUrgent, SqlStdEnum sqlStd) {
588+
return new DBConnectionImpl(asynTask, sslEnable, compress, python, ifUrgent, true, sqlStd);
589+
}
590+
575591
public DBConnection() {
576592
this(false, false, false);
577593
}
578594

579595
public DBConnection(SqlStdEnum sqlStd) {
580-
this(false, false, false, false, false, false, sqlStd);
596+
this(false, false, false, false, false, sqlStd);
581597
}
582598

583599
public DBConnection(boolean asynchronousTask) {
@@ -593,25 +609,39 @@ public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress)
593609
}
594610

595611
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython){
596-
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, false, SqlStdEnum.DolphinDB);
612+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, SqlStdEnum.DolphinDB);
597613
this.mutex_ = new ReentrantLock();
598614
}
599615

600616

601617
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, SqlStdEnum sqlStd){
602-
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, false, sqlStd);
618+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, false, sqlStd);
603619
this.mutex_ = new ReentrantLock();
604620
}
605621

606622
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, boolean isUrgent){
607-
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, false, SqlStdEnum.DolphinDB);
623+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, SqlStdEnum.DolphinDB);
608624
this.mutex_ = new ReentrantLock();
609625
}
610626

627+
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, boolean isUrgent, SqlStdEnum sqlStd){
628+
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, sqlStd);
629+
this.mutex_ = new ReentrantLock();
630+
}
631+
632+
@Deprecated
611633
public DBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, boolean isUrgent, boolean isReverseStreaming, SqlStdEnum sqlStd){
612634
this.conn_ = new DBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, isReverseStreaming, sqlStd);
613635
this.mutex_ = new ReentrantLock();
614636
}
637+
638+
public static DBConnection internalCreateEnableReverseStreamingDBConnection(boolean asynchronousTask, boolean useSSL, boolean compress, boolean usePython, boolean isUrgent, SqlStdEnum sqlStd) {
639+
DBConnection dbConnection = new DBConnection();
640+
dbConnection.conn_ = dbConnection.createEnableReverseStreamingDBConnectionImpl(asynchronousTask, useSSL, compress, usePython, isUrgent, sqlStd);
641+
dbConnection.mutex_ = new ReentrantLock();
642+
643+
return dbConnection;
644+
}
615645

616646
public boolean isBusy() {
617647
if (!mutex_.tryLock())

src/com/xxdb/streaming/client/AbstractClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ protected BlockingQueue<List<IMessage>> subscribeInternal(String host, int port,
426426
if (listeningPort > 0)
427427
dbConn = new DBConnection();
428428
else
429-
dbConn = new DBConnection(false, false, false, false, false, true, SqlStdEnum.DolphinDB);
429+
dbConn = DBConnection.internalCreateEnableReverseStreamingDBConnection(false, false, false, false, false, SqlStdEnum.DolphinDB);
430430

431431
if (!userName.equals(""))
432432
dbConn.connect(host, port, userName, passWord);

0 commit comments

Comments
 (0)