Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ private Connection innerCreateConnection() throws SQLException {
* @since ODC_release_3.2.2
* @see java.lang.reflect.InvocationHandler
*/
private static class CloseIgnoreInvocationHandler implements InvocationHandler {
public static class CloseIgnoreInvocationHandler implements InvocationHandler {
private final Connection target;
private final Lock lock;

Expand Down Expand Up @@ -242,6 +242,11 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
throw ex.getTargetException();
}
}

public Connection getTarget() {
return target;
}

}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.oceanbase.odc.plugin.connect.oboracle;

import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Objects;
Expand All @@ -24,6 +25,7 @@
import com.oceanbase.jdbc.OceanBaseConnection;
import com.oceanbase.odc.common.util.JdbcOperationsUtil;
import com.oceanbase.odc.common.util.StringUtils;
import com.oceanbase.odc.core.datasource.SingleConnectionDataSource.CloseIgnoreInvocationHandler;
import com.oceanbase.odc.plugin.connect.api.SessionExtensionPoint;

import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -67,6 +69,9 @@ public String getConnectionId(Connection connection) {
} catch (Exception e) {
if (connection instanceof OceanBaseConnection) {
connectionId = ((OceanBaseConnection) connection).getServerThreadId() + "";
} else if (Proxy.isProxyClass(connection.getClass())) {
Comment thread
yhilmare marked this conversation as resolved.
Outdated
Connection actual = ((CloseIgnoreInvocationHandler) Proxy.getInvocationHandler(connection)).getTarget();
connectionId = ((OceanBaseConnection) actual).getServerThreadId() + "";
}
}
return connectionId;
Expand Down