Skip to content

Commit e887652

Browse files
committed
s/EMPTY_CONTENT_BODY_FRAME_SIZE/EMPTY_FRAME_SIZE
more accurate and matching the naming in the server
1 parent d4ce614 commit e887652

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/com/rabbitmq/client/impl/AMQCommand.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
*/
3333
public class AMQCommand implements Command {
3434

35-
/** EMPTY_CONTENT_BODY_FRAME_SIZE = 8 = 1 + 2 + 4 + 1
35+
/** EMPTY_FRAME_SIZE = 8 = 1 + 2 + 4 + 1
3636
* <ul><li>1 byte of frame type</li>
3737
* <li>2 bytes of channel number</li>
3838
* <li>4 bytes of frame payload length</li>
3939
* <li>1 byte of payload trailer FRAME_END byte</li></ul>
40-
* See {@link #checkEmptyContentBodyFrameSize}, an assertion
41-
* checked at startup.
40+
* See {@link #checkEmptyFrameSize}, an assertion checked at
41+
* startup.
4242
*/
43-
public static final int EMPTY_CONTENT_BODY_FRAME_SIZE = 8;
43+
public static final int EMPTY_FRAME_SIZE = 8;
4444

4545
/** The assembler for this command - synchronised on - contains all the state */
4646
private final CommandAssembler assembler;
@@ -108,7 +108,7 @@ public void transmit(AMQChannel channel) throws IOException {
108108

109109
int frameMax = connection.getFrameMax();
110110
int bodyPayloadMax = (frameMax == 0) ? body.length : frameMax
111-
- EMPTY_CONTENT_BODY_FRAME_SIZE;
111+
- EMPTY_FRAME_SIZE;
112112

113113
for (int offset = 0; offset < body.length; offset += bodyPayloadMax) {
114114
int remaining = body.length - offset;
@@ -157,26 +157,26 @@ private static StringBuilder contentBodyStringBuilder(byte[] body, boolean suppr
157157

158158
/** Called to check internal code assumptions. */
159159
public static void checkPreconditions() {
160-
checkEmptyContentBodyFrameSize();
160+
checkEmptyFrameSize();
161161
}
162162

163163
/**
164-
* Since we're using a pre-computed value for
165-
* EMPTY_CONTENT_BODY_FRAME_SIZE we check this is
166-
* actually correct when run against the framing code in Frame.
164+
* Since we're using a pre-computed value for EMPTY_FRAME_SIZE we
165+
* check this is actually correct when run against the framing
166+
* code in Frame.
167167
*/
168-
private static void checkEmptyContentBodyFrameSize() {
168+
private static void checkEmptyFrameSize() {
169169
Frame f = new Frame(AMQP.FRAME_BODY, 0, new byte[0]);
170170
ByteArrayOutputStream s = new ByteArrayOutputStream();
171171
try {
172172
f.writeTo(new DataOutputStream(s));
173173
} catch (IOException ioe) {
174-
throw new AssertionError("IOException while checking EMPTY_CONTENT_BODY_FRAME_SIZE");
174+
throw new AssertionError("IOException while checking EMPTY_FRAME_SIZE");
175175
}
176176
int actualLength = s.toByteArray().length;
177-
if (EMPTY_CONTENT_BODY_FRAME_SIZE != actualLength) {
178-
throw new AssertionError("Internal error: expected EMPTY_CONTENT_BODY_FRAME_SIZE("
179-
+ EMPTY_CONTENT_BODY_FRAME_SIZE
177+
if (EMPTY_FRAME_SIZE != actualLength) {
178+
throw new AssertionError("Internal error: expected EMPTY_FRAME_SIZE("
179+
+ EMPTY_FRAME_SIZE
180180
+ ") is not equal to computed value: " + actualLength);
181181
}
182182
}

test/src/com/rabbitmq/client/test/functional/FrameMax.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ public GenerousAMQConnection(ConnectionFactory factory,
152152

153153
@Override public int getFrameMax() {
154154
// the RabbitMQ broker permits frames that are oversize by
155-
// up to EMPTY_CONTENT_BODY_FRAME_SIZE octets
156-
return super.getFrameMax() + AMQCommand.EMPTY_CONTENT_BODY_FRAME_SIZE + 1;
155+
// up to EMPTY_FRAME_SIZE octets
156+
return super.getFrameMax() + AMQCommand.EMPTY_FRAME_SIZE + 1;
157157
}
158158

159159
}

0 commit comments

Comments
 (0)