|
32 | 32 | */ |
33 | 33 | public class AMQCommand implements Command { |
34 | 34 |
|
35 | | - /** EMPTY_CONTENT_BODY_FRAME_SIZE = 8 = 1 + 2 + 4 + 1 |
| 35 | + /** EMPTY_FRAME_SIZE = 8 = 1 + 2 + 4 + 1 |
36 | 36 | * <ul><li>1 byte of frame type</li> |
37 | 37 | * <li>2 bytes of channel number</li> |
38 | 38 | * <li>4 bytes of frame payload length</li> |
39 | 39 | * <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. |
42 | 42 | */ |
43 | | - public static final int EMPTY_CONTENT_BODY_FRAME_SIZE = 8; |
| 43 | + public static final int EMPTY_FRAME_SIZE = 8; |
44 | 44 |
|
45 | 45 | /** The assembler for this command - synchronised on - contains all the state */ |
46 | 46 | private final CommandAssembler assembler; |
@@ -108,7 +108,7 @@ public void transmit(AMQChannel channel) throws IOException { |
108 | 108 |
|
109 | 109 | int frameMax = connection.getFrameMax(); |
110 | 110 | int bodyPayloadMax = (frameMax == 0) ? body.length : frameMax |
111 | | - - EMPTY_CONTENT_BODY_FRAME_SIZE; |
| 111 | + - EMPTY_FRAME_SIZE; |
112 | 112 |
|
113 | 113 | for (int offset = 0; offset < body.length; offset += bodyPayloadMax) { |
114 | 114 | int remaining = body.length - offset; |
@@ -157,26 +157,26 @@ private static StringBuilder contentBodyStringBuilder(byte[] body, boolean suppr |
157 | 157 |
|
158 | 158 | /** Called to check internal code assumptions. */ |
159 | 159 | public static void checkPreconditions() { |
160 | | - checkEmptyContentBodyFrameSize(); |
| 160 | + checkEmptyFrameSize(); |
161 | 161 | } |
162 | 162 |
|
163 | 163 | /** |
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. |
167 | 167 | */ |
168 | | - private static void checkEmptyContentBodyFrameSize() { |
| 168 | + private static void checkEmptyFrameSize() { |
169 | 169 | Frame f = new Frame(AMQP.FRAME_BODY, 0, new byte[0]); |
170 | 170 | ByteArrayOutputStream s = new ByteArrayOutputStream(); |
171 | 171 | try { |
172 | 172 | f.writeTo(new DataOutputStream(s)); |
173 | 173 | } 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"); |
175 | 175 | } |
176 | 176 | 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 |
180 | 180 | + ") is not equal to computed value: " + actualLength); |
181 | 181 | } |
182 | 182 | } |
|
0 commit comments