Skip to content

Commit 9f6ff0d

Browse files
committed
Cleanup in Oracle client, stop using CommandResponse which is actually not needed, since that is a command response message for Netty based pipelines.
1 parent 3095bfb commit 9f6ff0d

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

vertx-oracle-client/src/main/java/io/vertx/oracleclient/impl/OracleJdbcConnection.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,9 @@ private void checkPending() {
200200
metrics.close();
201201
}
202202
OracleCommand action = wrap(cmd);
203-
action.handler = handler;
204-
Future<Void> future = action.processCommand(cmd, handler);
203+
Future<?> future = action.processCommand(handler);
205204
CommandBase capture = cmd;
206-
future.onComplete(ar -> actionComplete(capture, action, ar));
205+
future.onComplete(ar -> actionComplete(action, ar));
207206
}
208207
} finally {
209208
executing = false;
@@ -254,7 +253,7 @@ private OracleCommand forExtendedQuery(ExtendedQueryCommand cmd) {
254253
return action;
255254
}
256255

257-
private void actionComplete(CommandBase cmd, OracleCommand<?> action, AsyncResult<Void> ar) {
256+
private void actionComplete(OracleCommand<?> action, AsyncResult<?> ar) {
258257
inflight = false;
259258
Future<Void> future = Future.succeededFuture();
260259
if (ar.failed()) {

vertx-oracle-client/src/main/java/io/vertx/oracleclient/impl/commands/OracleCommand.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
*/
1111
package io.vertx.oracleclient.impl.commands;
1212

13+
import io.vertx.core.AsyncResult;
1314
import io.vertx.core.Completable;
1415
import io.vertx.core.Future;
1516
import io.vertx.core.Promise;
1617
import io.vertx.core.internal.ContextInternal;
1718
import io.vertx.oracleclient.impl.Helper.SQLBlockingCodeHandler;
18-
import io.vertx.sqlclient.internal.command.CommandBase;
19-
import io.vertx.sqlclient.internal.command.CommandResponse;
2019
import oracle.jdbc.OracleConnection;
2120

2221
import java.util.concurrent.Flow;
@@ -26,26 +25,21 @@
2625

2726
public abstract class OracleCommand<T> {
2827

29-
public Completable<T> handler;
3028
protected final OracleConnection oracleConnection;
3129
protected final ContextInternal connectionContext;
32-
private CommandResponse<T> response;
30+
private Completable<T> handler;
31+
private AsyncResult<T> result;
3332

3433
protected OracleCommand(OracleConnection oracleConnection, ContextInternal connectionContext) {
3534
this.oracleConnection = oracleConnection;
3635
this.connectionContext = connectionContext;
3736
}
3837

39-
public final Future<Void> processCommand(CommandBase<T> cmd, Completable<T> handler) {
38+
public final Future<?> processCommand(Completable<T> handler) {
39+
this.handler = handler;
4040
return execute().andThen(ar -> {
41-
if (ar.succeeded()) {
42-
response = CommandResponse.success(ar.result());
43-
} else {
44-
response = CommandResponse.failure(ar.cause());
45-
}
46-
response.cmd = cmd;
47-
response.handler = handler;
48-
}).mapEmpty();
41+
this.result = ar;
42+
});
4943
}
5044

5145
protected abstract Future<T> execute();
@@ -90,6 +84,6 @@ public void onComplete() {
9084
}
9185

9286
public final void fireResponse() {
93-
response.fire();
87+
handler.complete(result.result(), result.cause());
9488
}
9589
}

0 commit comments

Comments
 (0)