File tree Expand file tree Collapse file tree 5 files changed +23
-1
lines changed
src/com/rabbitmq/client/impl Expand file tree Collapse file tree 5 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,9 @@ public void transmit(AMQChannel channel) throws IOException {
183183 connection .writeFrame (frame );
184184 }
185185 }
186+
187+ connection .flush ();
188+
186189 }
187190
188191 @ Override public String toString () {
Original file line number Diff line number Diff line change @@ -409,6 +409,13 @@ public void writeFrame(Frame f) throws IOException {
409409 _heartbeatSender .signalActivity ();
410410 }
411411
412+ /**
413+ * Public API - flush the output buffers
414+ */
415+ public void flush () throws IOException {
416+ _frameHandler .flush ();
417+ }
418+
412419 private static int negotiatedMaxValue (int clientValue , int serverValue ) {
413420 return (clientValue == 0 || serverValue == 0 ) ?
414421 Math .max (clientValue , serverValue ) :
Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ public interface FrameHandler {
7272 */
7373 void writeFrame (Frame frame ) throws IOException ;
7474
75+ /**
76+ * Flush the underlying data connection.
77+ *
78+ * @throws IOException if there is a problem accessing the connection
79+ */
80+ void flush () throws IOException ;
81+
7582 /**
7683 * Close the underlying data connection (complaint not permitted).
7784 */
Original file line number Diff line number Diff line change @@ -130,6 +130,7 @@ public void run() {
130130
131131 if (now > (lastActivityTime + this .heartbeatNanos )) {
132132 frameHandler .writeFrame (new Frame (AMQP .FRAME_HEARTBEAT , 0 ));
133+ frameHandler .flush ();
133134 }
134135 } catch (IOException e ) {
135136 // ignore
Original file line number Diff line number Diff line change @@ -152,12 +152,16 @@ public Frame readFrame() throws IOException {
152152 public void writeFrame (Frame frame ) throws IOException {
153153 synchronized (_outputStream ) {
154154 frame .writeTo (_outputStream );
155- _outputStream .flush ();
156155 }
157156 }
158157
158+ public void flush () throws IOException {
159+ _outputStream .flush ();
160+ }
161+
159162 public void close () {
160163 try {
164+ flush ();
161165 _socket .close ();
162166 } catch (IOException ioe ) {
163167 // Ignore.
You can’t perform that action at this time.
0 commit comments