This is an automated email from the ASF dual-hosted git repository.
petrov-mg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 051332deba9 IGNITE-28666 Removed orphaned JdbcRequestHandlerWorker and
OdbcRequestHandlerWorker classes (#13127)
051332deba9 is described below
commit 051332deba99bf90db419738b40bb97c66c32f14
Author: Mikhail Petrov <[email protected]>
AuthorDate: Wed May 13 13:38:25 2026 +0300
IGNITE-28666 Removed orphaned JdbcRequestHandlerWorker and
OdbcRequestHandlerWorker classes (#13127)
---
.../odbc/jdbc/JdbcConnectionContext.java | 2 -
.../processors/odbc/jdbc/JdbcRequestHandler.java | 26 -----
.../odbc/jdbc/JdbcRequestHandlerWorker.java | 130 ---------------------
.../odbc/odbc/OdbcConnectionContext.java | 2 -
.../processors/odbc/odbc/OdbcRequestHandler.java | 25 ----
.../odbc/odbc/OdbcRequestHandlerWorker.java | 130 ---------------------
6 files changed, 315 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
index 4800afcb503..5e17a76212e 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcConnectionContext.java
@@ -285,8 +285,6 @@ public class JdbcConnectionContext extends
ClientListenerAbstractConnectionConte
dataPageScanEnabled, updateBatchSize,
concurrency, isolation, timeout, lb,
ver, this);
-
- handler.start();
}
/** {@inheritDoc} */
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
index b999242274b..0f3b5e0bbbc 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandler.java
@@ -138,9 +138,6 @@ public class JdbcRequestHandler implements
ClientListenerRequestHandler, ClientT
/** Busy lock. */
private final GridSpinBusyLock busyLock;
- /** Worker. */
- private final JdbcRequestHandlerWorker worker;
-
/** Maximum allowed cursors. */
private final int maxCursors;
@@ -249,10 +246,6 @@ public class JdbcRequestHandler implements
ClientListenerRequestHandler, ClientT
this.protocolVer = protocolVer;
log = connCtx.kernalContext().log(getClass());
-
- // TODO IGNITE-9484 Do not create worker if there is a possibility to
unbind TX from threads.
- worker = new
JdbcRequestHandlerWorker(connCtx.kernalContext().igniteInstanceName(), log,
this,
- connCtx.kernalContext());
}
/** {@inheritDoc} */
@@ -289,14 +282,6 @@ public class JdbcRequestHandler implements
ClientListenerRequestHandler, ClientT
}
}
- /**
- * Start worker, if it's present.
- */
- void start() {
- if (worker != null)
- worker.start();
- }
-
/**
* Actually handle the request.
* @param req Request.
@@ -557,17 +542,6 @@ public class JdbcRequestHandler implements
ClientListenerRequestHandler, ClientT
* or due to {@code IOException} during network operations.
*/
public void onDisconnect() {
- if (worker != null) {
- worker.cancel();
-
- try {
- worker.join();
- }
- catch (InterruptedException e) {
- // No-op.
- }
- }
-
for (JdbcCursor cursor : jdbcCursors.values())
U.close(cursor, log);
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandlerWorker.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandlerWorker.java
deleted file mode 100644
index 965db4f9810..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/jdbc/JdbcRequestHandlerWorker.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc.jdbc;
-
-import java.util.concurrent.LinkedBlockingQueue;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
-import org.apache.ignite.internal.processors.odbc.ClientListenerNioListener;
-import org.apache.ignite.internal.processors.odbc.ClientListenerResponse;
-import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.util.worker.GridWorker;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * JDBC request handler worker to maintain single threaded transactional
execution of SQL statements when MVCC is on.<p>
- * This worker is intended for internal use as a temporary solution and from
within {@link JdbcRequestHandler},
- * therefore it does not do any fine-grained lifecycle handling as it relies
on existing guarantees from
- * {@link ClientListenerNioListener}.
- */
-class JdbcRequestHandlerWorker extends GridWorker {
- /** Requests queue.*/
- private final LinkedBlockingQueue<T2<JdbcRequest,
GridFutureAdapter<ClientListenerResponse>>> queue =
- new LinkedBlockingQueue<>();
-
- /** Handler.*/
- private final JdbcRequestHandler hnd;
-
- /** Context.*/
- private final GridKernalContext ctx;
-
- /** Response */
- private static final ClientListenerResponse ERR_RESPONSE = new
JdbcResponse(IgniteQueryErrorCode.UNKNOWN,
- "Connection closed.");
-
- /**
- * Constructor.
- * @param igniteInstanceName Instance name.
- * @param log Logger.
- * @param hnd Handler.
- * @param ctx Kernal context.
- */
- JdbcRequestHandlerWorker(@Nullable String igniteInstanceName, IgniteLogger
log, JdbcRequestHandler hnd,
- GridKernalContext ctx) {
- super(igniteInstanceName, "jdbc-request-handler-worker", log);
-
- A.notNull(hnd, "hnd");
-
- this.hnd = hnd;
-
- this.ctx = ctx;
- }
-
- /**
- * Start this worker.
- */
- void start() {
- U.newThread(this).start();
- }
-
- /** {@inheritDoc} */
- @Override protected void body() throws InterruptedException,
IgniteInterruptedCheckedException {
- try {
- while (!isCancelled()) {
- T2<JdbcRequest, GridFutureAdapter<ClientListenerResponse>> req
= queue.take();
-
- GridFutureAdapter<ClientListenerResponse> fut = req.get2();
-
- try {
- JdbcResponse res = hnd.doHandle(req.get1());
-
- fut.onDone(res);
- }
- catch (Exception e) {
- fut.onDone(e);
- }
- }
- }
- finally {
- // Notify indexing that this worker is being stopped.
- try {
- ctx.query().onClientDisconnect();
- }
- catch (Exception ignored) {
- // No-op.
- }
-
- // Drain the queue on stop.
- T2<JdbcRequest, GridFutureAdapter<ClientListenerResponse>> req =
queue.poll();
-
- while (req != null) {
- req.get2().onDone(ERR_RESPONSE);
-
- req = queue.poll();
- }
- }
- }
-
- /**
- * Initiate request processing.
- * @param req Request.
- * @return Future to track request processing.
- */
- GridFutureAdapter<ClientListenerResponse> process(JdbcRequest req) {
- GridFutureAdapter<ClientListenerResponse> fut = new
GridFutureAdapter<>();
-
- queue.add(new T2<>(req, fut));
-
- return fut;
- }
-}
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
index 2bb58c5b0b7..096eef728ae 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcConnectionContext.java
@@ -204,8 +204,6 @@ public class OdbcConnectionContext extends
ClientListenerAbstractConnectionConte
replicatedOnly, collocated, skipReducerOnUpdate, qryEngine, ver,
this);
parser = new OdbcMessageParser(ctx, ver);
-
- handler.start();
}
/** {@inheritDoc} */
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
index 3ca6ec93055..168205d1364 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandler.java
@@ -92,9 +92,6 @@ public class OdbcRequestHandler implements
ClientListenerRequestHandler {
/** Busy lock. */
private final GridSpinBusyLock busyLock;
- /** Worker. */
- private final OdbcRequestHandlerWorker worker;
-
/** Maximum allowed cursors. */
private final int maxCursors;
@@ -176,9 +173,6 @@ public class OdbcRequestHandler implements
ClientListenerRequestHandler {
this.ver = ver;
log = ctx.log(getClass());
-
- // TODO IGNITE-9484 Do not create worker if there is a possibility to
unbind TX from threads.
- worker = new OdbcRequestHandlerWorker(ctx.igniteInstanceName(), log,
this, ctx);
}
/** {@inheritDoc} */
@@ -190,14 +184,6 @@ public class OdbcRequestHandler implements
ClientListenerRequestHandler {
return doHandle((OdbcRequest)req);
}
- /**
- * Start worker, if it's present.
- */
- void start() {
- if (worker != null)
- worker.start();
- }
-
/**
* Handle ODBC request.
* @param req ODBC request.
@@ -264,17 +250,6 @@ public class OdbcRequestHandler implements
ClientListenerRequestHandler {
*/
public void onDisconnect() {
if (busyLock.enterBusy()) {
- if (worker != null) {
- worker.cancel();
-
- try {
- worker.join();
- }
- catch (InterruptedException e) {
- // No-op.
- }
- }
-
try {
for (OdbcQueryResults res : qryResults.values())
res.closeAll();
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandlerWorker.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandlerWorker.java
deleted file mode 100644
index 26c2b865c0d..00000000000
---
a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/odbc/OdbcRequestHandlerWorker.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.odbc.odbc;
-
-import java.util.concurrent.LinkedBlockingQueue;
-import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
-import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
-import org.apache.ignite.internal.processors.odbc.ClientListenerNioListener;
-import org.apache.ignite.internal.processors.odbc.ClientListenerResponse;
-import org.apache.ignite.internal.util.future.GridFutureAdapter;
-import org.apache.ignite.internal.util.typedef.T2;
-import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.util.worker.GridWorker;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * ODBC request handler worker to maintain single threaded transactional
execution of SQL statements when MVCC is on.<p>
- * This worker is intended for internal use as a temporary solution and from
within {@link OdbcRequestHandler},
- * therefore it does not do any fine-grained lifecycle handling as it relies
on existing guarantees from
- * {@link ClientListenerNioListener}.
- */
-class OdbcRequestHandlerWorker extends GridWorker {
- /** Requests queue.*/
- private final LinkedBlockingQueue<T2<OdbcRequest,
GridFutureAdapter<ClientListenerResponse>>> queue =
- new LinkedBlockingQueue<>();
-
- /** Handler.*/
- private final OdbcRequestHandler hnd;
-
- /** Context.*/
- private final GridKernalContext ctx;
-
- /** Response */
- private static final ClientListenerResponse ERR_RESPONSE = new
OdbcResponse(IgniteQueryErrorCode.UNKNOWN,
- "Connection closed.");
-
- /**
- * Constructor.
- * @param igniteInstanceName Instance name.
- * @param log Logger.
- * @param hnd Handler.
- * @param ctx Kernal context.
- */
- OdbcRequestHandlerWorker(@Nullable String igniteInstanceName, IgniteLogger
log, OdbcRequestHandler hnd,
- GridKernalContext ctx) {
- super(igniteInstanceName, "odbc-request-handler-worker", log);
-
- A.notNull(hnd, "hnd");
-
- this.hnd = hnd;
-
- this.ctx = ctx;
- }
-
- /**
- * Start this worker.
- */
- void start() {
- U.newThread(this).start();
- }
-
- /** {@inheritDoc} */
- @Override protected void body() throws InterruptedException,
IgniteInterruptedCheckedException {
- try {
- while (!isCancelled()) {
- T2<OdbcRequest, GridFutureAdapter<ClientListenerResponse>> req
= queue.take();
-
- GridFutureAdapter<ClientListenerResponse> fut = req.get2();
-
- try {
- ClientListenerResponse res = hnd.doHandle(req.get1());
-
- fut.onDone(res);
- }
- catch (Exception e) {
- fut.onDone(e);
- }
- }
- }
- finally {
- // Notify indexing that this worker is being stopped.
- try {
- ctx.query().onClientDisconnect();
- }
- catch (Exception e) {
- // No-op.
- }
-
- // Drain the queue on stop.
- T2<OdbcRequest, GridFutureAdapter<ClientListenerResponse>> req =
queue.poll();
-
- while (req != null) {
- req.get2().onDone(ERR_RESPONSE);
-
- req = queue.poll();
- }
- }
- }
-
- /**
- * Initiate request processing.
- * @param req Request.
- * @return Future to track request processing.
- */
- GridFutureAdapter<ClientListenerResponse> process(OdbcRequest req) {
- GridFutureAdapter<ClientListenerResponse> fut = new
GridFutureAdapter<>();
-
- queue.add(new T2<>(req, fut));
-
- return fut;
- }
-}