Skip to content

Commit 7d64d85

Browse files
committed
DB2 command messages should be named DB2CommandMessage instead of DB2CommandCodec for more clarity.
1 parent 7e93c76 commit 7d64d85

17 files changed

+57
-57
lines changed

vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2SocketConnection.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
import io.vertx.core.internal.net.NetSocketInternal;
2424
import io.vertx.core.spi.metrics.ClientMetrics;
2525
import io.vertx.db2client.DB2ConnectOptions;
26-
import io.vertx.db2client.impl.codec.CommandCodec;
26+
import io.vertx.db2client.impl.codec.DB2CommandMessage;
2727
import io.vertx.db2client.impl.codec.DB2Codec;
2828
import io.vertx.db2client.impl.codec.DB2PreparedStatement;
29-
import io.vertx.db2client.impl.codec.ExtendedBatchQueryCommandCodec;
30-
import io.vertx.db2client.impl.codec.ExtendedQueryCommandCodec;
29+
import io.vertx.db2client.impl.codec.ExtendedBatchQueryDB2CommandMessage;
30+
import io.vertx.db2client.impl.codec.ExtendedQueryDB2CommandMessage;
3131
import io.vertx.db2client.impl.command.InitialHandshakeCommand;
3232
import io.vertx.db2client.impl.drda.ConnectionMetaData;
3333
import io.vertx.sqlclient.SqlConnectOptions;
@@ -90,15 +90,15 @@ public void init() {
9090
@Override
9191
protected CommandMessage<?, ?> toMessage(ExtendedQueryCommand<?> command, PreparedStatement preparedStatement) {
9292
if (command.isBatch()) {
93-
return new ExtendedBatchQueryCommandCodec<>(command, (DB2PreparedStatement) preparedStatement);
93+
return new ExtendedBatchQueryDB2CommandMessage<>(command, (DB2PreparedStatement) preparedStatement);
9494
} else {
95-
return new ExtendedQueryCommandCodec(command, (DB2PreparedStatement) preparedStatement);
95+
return new ExtendedQueryDB2CommandMessage(command, (DB2PreparedStatement) preparedStatement);
9696
}
9797
}
9898

9999
@Override
100100
protected CommandMessage<?, ?> toMessage(CommandBase<?> command) {
101-
return CommandCodec.wrap(command);
101+
return DB2CommandMessage.wrap(command);
102102
}
103103

104104
@Override
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
import io.vertx.db2client.impl.command.AuthenticationCommandBase;
1919

20-
abstract class AuthenticationCommandBaseCodec<R, C extends AuthenticationCommandBase<R>> extends CommandCodec<R, C> {
20+
abstract class AuthenticationDB2CommandBaseMessage<R, C extends AuthenticationCommandBase<R>> extends DB2CommandMessage<R, C> {
2121

22-
AuthenticationCommandBaseCodec(C cmd) {
22+
AuthenticationDB2CommandBaseMessage(C cmd) {
2323
super(cmd);
2424
}
2525

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
import io.vertx.db2client.impl.drda.DRDAQueryResponse;
2121
import io.vertx.sqlclient.spi.protocol.CloseConnectionCommand;
2222

23-
class CloseConnectionCommandCodec extends CommandCodec<Void, CloseConnectionCommand> {
23+
class CloseConnectionDB2CommandMessage extends DB2CommandMessage<Void, CloseConnectionCommand> {
2424

25-
CloseConnectionCommandCodec(CloseConnectionCommand cmd) {
25+
CloseConnectionDB2CommandMessage(CloseConnectionCommand cmd) {
2626
super(cmd);
2727
}
2828

vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/CloseCursorCommandCodec.java renamed to vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/CloseCursorDB2CommandMessage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424
import io.vertx.sqlclient.spi.protocol.CloseCursorCommand;
2525
import io.vertx.sqlclient.codec.CommandResponse;
2626

27-
class CloseCursorCommandCodec extends CommandCodec<Void, CloseCursorCommand> {
27+
class CloseCursorDB2CommandMessage extends DB2CommandMessage<Void, CloseCursorCommand> {
2828

29-
private static final Logger LOG = LoggerFactory.getLogger(CloseCursorCommandCodec.class);
29+
private static final Logger LOG = LoggerFactory.getLogger(CloseCursorDB2CommandMessage.class);
3030

31-
CloseCursorCommandCodec(CloseCursorCommand cmd) {
31+
CloseCursorDB2CommandMessage(CloseCursorCommand cmd) {
3232
super(cmd);
3333
}
3434

vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/CloseStatementCommandCodec.java renamed to vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/CloseStatementDB2CommandMessage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import io.vertx.sqlclient.spi.protocol.CloseStatementCommand;
2020
import io.vertx.sqlclient.codec.CommandResponse;
2121

22-
class CloseStatementCommandCodec extends CommandCodec<Void, CloseStatementCommand> {
22+
class CloseStatementDB2CommandMessage extends DB2CommandMessage<Void, CloseStatementCommand> {
2323

24-
CloseStatementCommandCodec(CloseStatementCommand cmd) {
24+
CloseStatementDB2CommandMessage(CloseStatementCommand cmd) {
2525
super(cmd);
2626
}
2727

vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/DB2Codec.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class DB2Codec extends CombinedChannelDuplexHandler<DB2Decoder, DB2Encode
2727
// TODO @AGG check what packet length limit actually is for DB2
2828
static final int PACKET_PAYLOAD_LENGTH_LIMIT = 0xFFFFFF;
2929

30-
private final ArrayDeque<CommandCodec<?, ?>> inflight = new ArrayDeque<>();
30+
private final ArrayDeque<DB2CommandMessage<?, ?>> inflight = new ArrayDeque<>();
3131

3232
public DB2Codec(DB2SocketConnection db2SocketConnection) {
3333
DB2Encoder encoder = new DB2Encoder(inflight, db2SocketConnection);
@@ -42,8 +42,8 @@ public void channelInactive(ChannelHandlerContext ctx) throws Exception {
4242
}
4343

4444
private void clearInflightCommands(Throwable failure) {
45-
for (CommandCodec<?, ?> commandCodec : inflight) {
46-
commandCodec.fail(failure);
45+
for (DB2CommandMessage<?, ?> commandMsg : inflight) {
46+
commandMsg.fail(failure);
4747
}
4848
}
4949
}

vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/CommandCodec.java renamed to vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/DB2CommandMessage.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,34 +28,34 @@
2828
import io.vertx.sqlclient.spi.protocol.PrepareStatementCommand;
2929
import io.vertx.sqlclient.spi.protocol.SimpleQueryCommand;
3030

31-
public abstract class CommandCodec<R, C extends CommandBase<R>> extends CommandMessage<R, C> {
31+
public abstract class DB2CommandMessage<R, C extends CommandBase<R>> extends CommandMessage<R, C> {
3232

3333
Handler<? super CommandResponse<R>> completionHandler;
3434
public Throwable failure;
3535
public R result;
3636
DB2Encoder encoder;
3737

38-
CommandCodec(C cmd) {
38+
DB2CommandMessage(C cmd) {
3939
super(cmd);
4040
}
4141

4242
@SuppressWarnings({ "rawtypes", "unchecked" })
43-
public static CommandCodec<?, ?> wrap(CommandBase<?> cmd) {
44-
CommandCodec<?, ?> codec = null;
43+
public static DB2CommandMessage<?, ?> wrap(CommandBase<?> cmd) {
44+
DB2CommandMessage<?, ?> codec = null;
4545
if (cmd instanceof InitialHandshakeCommand) {
46-
codec = new InitialHandshakeCommandCodec((InitialHandshakeCommand) cmd);
46+
codec = new InitialHandshakeDB2CommandMessage((InitialHandshakeCommand) cmd);
4747
} else if (cmd instanceof SimpleQueryCommand) {
48-
codec = new SimpleQueryCommandCodec((SimpleQueryCommand) cmd);
48+
codec = new SimpleQueryDB2CommandMessage((SimpleQueryCommand) cmd);
4949
} else if (cmd instanceof CloseConnectionCommand) {
50-
codec = new CloseConnectionCommandCodec((CloseConnectionCommand) cmd);
50+
codec = new CloseConnectionDB2CommandMessage((CloseConnectionCommand) cmd);
5151
} else if (cmd instanceof PrepareStatementCommand) {
52-
codec = new PrepareStatementCodec((PrepareStatementCommand) cmd);
52+
codec = new PrepareStatementDB2CommandMessage((PrepareStatementCommand) cmd);
5353
} else if (cmd instanceof CloseStatementCommand) {
54-
codec = new CloseStatementCommandCodec((CloseStatementCommand) cmd);
54+
codec = new CloseStatementDB2CommandMessage((CloseStatementCommand) cmd);
5555
} else if (cmd instanceof CloseCursorCommand) {
56-
codec = new CloseCursorCommandCodec((CloseCursorCommand) cmd);
56+
codec = new CloseCursorDB2CommandMessage((CloseCursorCommand) cmd);
5757
} else if (cmd instanceof PingCommand) {
58-
codec = new PingCommandCodec((PingCommand) cmd);
58+
codec = new PingDB2CommandMessage((PingCommand) cmd);
5959
// } else if (cmd instanceof InitDbCommand) {
6060
// codec = new InitDbCommandCodec((InitDbCommand) cmd);
6161
// } else if (cmd instanceof StatisticsCommand) {

vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/DB2Decoder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class DB2Decoder extends ByteToMessageDecoder {
3131

3232
private static final Logger LOG = LoggerFactory.getLogger(DB2Decoder.class);
3333

34-
private final ArrayDeque<CommandCodec<?, ?>> inflight;
34+
private final ArrayDeque<DB2CommandMessage<?, ?>> inflight;
3535

36-
DB2Decoder(ArrayDeque<CommandCodec<?, ?>> inflight) {
36+
DB2Decoder(ArrayDeque<DB2CommandMessage<?, ?>> inflight) {
3737
this.inflight = inflight;
3838
}
3939

@@ -71,7 +71,7 @@ private int computeLength(ByteBuf in) {
7171
}
7272

7373
private void decodePayload(ByteBuf payload, int payloadLength) {
74-
CommandCodec<?, ?> ctx = inflight.peek();
74+
DB2CommandMessage<?, ?> ctx = inflight.peek();
7575
int startIndex = payload.readerIndex();
7676
try {
7777
if (LOG.isDebugEnabled())

vertx-db2-client/src/main/java/io/vertx/db2client/impl/codec/DB2Encoder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ class DB2Encoder extends ChannelOutboundHandlerAdapter {
3030

3131
public static final Logger LOG = LoggerFactory.getLogger(DB2Encoder.class);
3232

33-
private final ArrayDeque<CommandCodec<?, ?>> inflight;
33+
private final ArrayDeque<DB2CommandMessage<?, ?>> inflight;
3434
ChannelHandlerContext chctx;
3535

3636
final DB2SocketConnection socketConnection;
3737

38-
DB2Encoder(ArrayDeque<CommandCodec<?, ?>> inflight, DB2SocketConnection db2SocketConnection) {
38+
DB2Encoder(ArrayDeque<DB2CommandMessage<?, ?>> inflight, DB2SocketConnection db2SocketConnection) {
3939
this.inflight = inflight;
4040
this.socketConnection = db2SocketConnection;
4141
}
@@ -47,18 +47,18 @@ public void handlerAdded(ChannelHandlerContext ctx) {
4747

4848
@Override
4949
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
50-
if (msg instanceof CommandCodec<?, ?>) {
51-
CommandCodec<?, ?> cmd = (CommandCodec<?, ?>) msg;
50+
if (msg instanceof DB2CommandMessage<?, ?>) {
51+
DB2CommandMessage<?, ?> cmd = (DB2CommandMessage<?, ?>) msg;
5252
write(cmd);
5353
} else {
5454
super.write(ctx, msg, promise);
5555
}
5656
}
5757

5858
@SuppressWarnings({ "unchecked", "rawtypes" })
59-
void write(CommandCodec<?, ?> msg) {
59+
void write(DB2CommandMessage<?, ?> msg) {
6060
msg.completionHandler = resp -> {
61-
CommandCodec<?, ?> c = inflight.poll();
61+
DB2CommandMessage<?, ?> c = inflight.poll();
6262
resp.handler = (Completable) c.handler;
6363
chctx.fireChannelRead(resp);
6464
};
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@
3131
import io.vertx.sqlclient.codec.CommandResponse;
3232
import io.vertx.sqlclient.spi.protocol.ExtendedQueryCommand;
3333

34-
public class ExtendedBatchQueryCommandCodec<R> extends ExtendedQueryCommandBaseCodec<R, ExtendedQueryCommand<R>> {
34+
public class ExtendedBatchQueryDB2CommandMessage<R> extends ExtendedQueryDB2CommandBaseMessage<R, ExtendedQueryCommand<R>> {
3535

36-
private static final Logger LOG = LoggerFactory.getLogger(ExtendedBatchQueryCommandCodec.class);
36+
private static final Logger LOG = LoggerFactory.getLogger(ExtendedBatchQueryDB2CommandMessage.class);
3737

3838
private final List<TupleBase> params;
3939
private final List<QueryInstance> queryInstances;
4040
private final String baseCursorId;
4141

42-
public ExtendedBatchQueryCommandCodec(ExtendedQueryCommand<R> cmd, DB2PreparedStatement statement) {
42+
public ExtendedBatchQueryDB2CommandMessage(ExtendedQueryCommand<R> cmd, DB2PreparedStatement statement) {
4343
super(cmd, statement);
4444
params = cmd.paramsList();
4545
queryInstances = new ArrayList<>(params.size());

0 commit comments

Comments
 (0)