@@ -745,8 +745,7 @@ Long getListenerPoolSize() {
745745
746746 @ Override
747747 public boolean isValid (int timeout ) throws SQLException {
748- try (BigQueryJdbcMdc .MdcCloseable mdc =
749- BigQueryJdbcMdc .registerInstance (this , this .connectionId )) {
748+ try (BigQueryJdbcMdc .MdcCloseable mdc = BigQueryJdbcMdc .setContext (this .connectionId )) {
750749 LOG .finest ("++enter++" );
751750 LOG .info ("Validating connection" );
752751 if (timeout < 0 ) {
@@ -771,8 +770,7 @@ public boolean isValid(int timeout) throws SQLException {
771770
772771 @ Override
773772 public void abort (Executor executor ) throws SQLException {
774- try (BigQueryJdbcMdc .MdcCloseable mdc =
775- BigQueryJdbcMdc .registerInstance (this , this .connectionId )) {
773+ try (BigQueryJdbcMdc .MdcCloseable mdc = BigQueryJdbcMdc .setContext (this .connectionId )) {
776774 LOG .finest ("++enter++" );
777775 close ();
778776 }
@@ -822,8 +820,7 @@ public void clearWarnings() {
822820
823821 @ Override
824822 public boolean getAutoCommit () {
825- try (BigQueryJdbcMdc .MdcCloseable mdc =
826- BigQueryJdbcMdc .registerInstance (this , this .connectionId )) {
823+ try (BigQueryJdbcMdc .MdcCloseable mdc = BigQueryJdbcMdc .setContext (this .connectionId )) {
827824 LOG .finest ("++enter++" );
828825 checkClosed ();
829826 return this .autoCommit ;
@@ -832,8 +829,7 @@ public boolean getAutoCommit() {
832829
833830 @ Override
834831 public void setAutoCommit (boolean autoCommit ) throws SQLException {
835- try (BigQueryJdbcMdc .MdcCloseable mdc =
836- BigQueryJdbcMdc .registerInstance (this , this .connectionId )) {
832+ try (BigQueryJdbcMdc .MdcCloseable mdc = BigQueryJdbcMdc .setContext (this .connectionId )) {
837833 LOG .finest ("++enter++" );
838834 checkClosed ();
839835 checkIfEnabledSession ("setAutoCommit" );
@@ -932,8 +928,7 @@ public int getTransactionIsolation() {
932928
933929 @ Override
934930 public void setTransactionIsolation (int level ) throws SQLException {
935- try (BigQueryJdbcMdc .MdcCloseable mdc =
936- BigQueryJdbcMdc .registerInstance (this , this .connectionId )) {
931+ try (BigQueryJdbcMdc .MdcCloseable mdc = BigQueryJdbcMdc .setContext (this .connectionId )) {
937932 LOG .finest ("++enter++" );
938933 if (level != Connection .TRANSACTION_SERIALIZABLE ) {
939934 throw new BigQueryJdbcSqlFeatureNotSupportedException (
@@ -951,8 +946,7 @@ public int getHoldability() {
951946
952947 @ Override
953948 public void setHoldability (int holdability ) throws SQLException {
954- try (BigQueryJdbcMdc .MdcCloseable mdc =
955- BigQueryJdbcMdc .registerInstance (this , this .connectionId )) {
949+ try (BigQueryJdbcMdc .MdcCloseable mdc = BigQueryJdbcMdc .setContext (this .connectionId )) {
956950 if (holdability != ResultSet .CLOSE_CURSORS_AT_COMMIT ) {
957951 throw new BigQueryJdbcSqlFeatureNotSupportedException (
958952 "CLOSE_CURSORS_AT_COMMIT not supported" );
0 commit comments