print the java.library.path variable for debug

format the code
This commit is contained in:
xieyinglin 2019-10-26 11:46:23 +08:00
parent 6919818225
commit 0fcdb5ae39
1 changed files with 185 additions and 181 deletions

View File

@ -23,6 +23,7 @@ public class TSDBJNIConnector {
static {
System.loadLibrary("taos");
System.out.println("java.library.path:" + System.getProperty("java.library.path"));
}
/**
@ -50,6 +51,7 @@ public class TSDBJNIConnector {
/**
* Returns the status of last result set in current connection
*
* @return
*/
public boolean isResultsetClosed() {
@ -60,7 +62,7 @@ public class TSDBJNIConnector {
* Initialize static variables in JNI to optimize performance
*/
public static void init(String configDir, String locale, String charset, String timezone) throws SQLWarning {
synchronized(isInitialized) {
synchronized (isInitialized) {
if (!isInitialized) {
initImp(configDir);
if (setOptions(0, locale) < 0) {
@ -179,7 +181,7 @@ public class TSDBJNIConnector {
int res = TSDBConstants.JNI_SUCCESS;
if (result != taosResultSetPointer && taosResultSetPointer != TSDBConstants.JNI_NULL_POINTER) {
throw new RuntimeException("Invalid result set pointer");
} else if (taosResultSetPointer != TSDBConstants.JNI_NULL_POINTER){
} else if (taosResultSetPointer != TSDBConstants.JNI_NULL_POINTER) {
res = this.freeResultSetImp(this.taos, result);
isResultsetClosed = true; // reset resultSetPointer to 0 after freeResultSetImp() return
taosResultSetPointer = TSDBConstants.JNI_NULL_POINTER;
@ -192,6 +194,7 @@ public class TSDBJNIConnector {
/**
* Close the open result set which is associated to the current connection. If the result set is already
* closed, return 0 for success.
*
* @return
*/
public int freeResultSet() {
@ -246,7 +249,7 @@ public class TSDBJNIConnector {
int code = this.closeConnectionImp(this.taos);
if (code < 0) {
throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode());
} else if (code == 0){
} else if (code == 0) {
this.taos = TSDBConstants.JNI_NULL_POINTER;
} else {
throw new SQLException("Undefined error code returned by TDengine when closing a connection");
@ -258,7 +261,7 @@ public class TSDBJNIConnector {
/**
* Subscribe to a table in TSDB
*/
public long subscribe(String host, String user, String password, String database, String table, long time, int period){
public long subscribe(String host, String user, String password, String database, String table, long time, int period) {
return subscribeImp(host, user, password, database, table, time, period);
}
@ -275,6 +278,7 @@ public class TSDBJNIConnector {
/**
* Unsubscribe a table
*
* @param subscription
*/
public void unsubscribe(long subscription) {