mirror of https://github.com/apache/iotdb
[IOTDB-300]reconnection to requestStmtId when broke pip (#543)
This commit is contained in:
parent
d8415e9ab8
commit
ef16fad43a
|
@ -196,9 +196,7 @@ public class IoTDBStatement implements Statement {
|
|||
try {
|
||||
return executeSQL(sql);
|
||||
} catch (TException e) {
|
||||
boolean flag = connection.reconnect();
|
||||
reInit();
|
||||
if (flag) {
|
||||
if (reConnect()) {
|
||||
try {
|
||||
return executeSQL(sql);
|
||||
} catch (TException e2) {
|
||||
|
@ -337,9 +335,7 @@ public class IoTDBStatement implements Statement {
|
|||
try {
|
||||
return executeBatchSQL();
|
||||
} catch (TException e) {
|
||||
boolean flag = connection.reconnect();
|
||||
reInit();
|
||||
if (flag) {
|
||||
if (reConnect()) {
|
||||
try {
|
||||
return executeBatchSQL();
|
||||
} catch (TException e2) {
|
||||
|
@ -394,9 +390,7 @@ public class IoTDBStatement implements Statement {
|
|||
try {
|
||||
return executeQuerySQL(sql);
|
||||
} catch (TException e) {
|
||||
boolean flag = connection.reconnect();
|
||||
reInit();
|
||||
if (flag) {
|
||||
if (reConnect()) {
|
||||
try {
|
||||
return executeQuerySQL(sql);
|
||||
} catch (TException e2) {
|
||||
|
@ -434,9 +428,7 @@ public class IoTDBStatement implements Statement {
|
|||
try {
|
||||
return executeUpdateSQL(sql);
|
||||
} catch (TException e) {
|
||||
boolean flag = connection.reconnect();
|
||||
reInit();
|
||||
if (flag) {
|
||||
if (reConnect()) {
|
||||
try {
|
||||
return executeUpdateSQL(sql);
|
||||
} catch (TException e2) {
|
||||
|
@ -644,7 +636,25 @@ public class IoTDBStatement implements Statement {
|
|||
try {
|
||||
this.stmtId = client.requestStatementId();
|
||||
} catch (TException e) {
|
||||
throw new SQLException("Cannot get id for statement", e);
|
||||
if (reConnect()) {
|
||||
try {
|
||||
this.stmtId = client.requestStatementId();
|
||||
} catch (TException e2) {
|
||||
throw new SQLException(
|
||||
"Cannot get id for statement after reconnecting. please check server status",
|
||||
e2);
|
||||
}
|
||||
} else {
|
||||
throw new SQLException(
|
||||
"Cannot get id for statement after reconnecting. please check server status", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean reConnect(){
|
||||
boolean flag = connection.reconnect();
|
||||
reInit();
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue