Search in sources :

Example 11 with TcpOutputStream

use of org.apache.servicecomb.foundation.vertx.tcp.TcpOutputStream in project incubator-servicecomb-java-chassis by apache.

the class TcpClientConnection method writeToBufferQueue.

private boolean writeToBufferQueue(AbstractTcpClientPackage tcpClientPackage) {
    // just optimize for main scenes
    if (Status.WORKING.equals(status)) {
        // encode in sender thread
        try (TcpOutputStream os = tcpClientPackage.createStream()) {
            write(os.getByteBuf());
            tcpClientPackage.finishWriteToBuffer();
        }
        return true;
    }
    return false;
}
Also used : TcpOutputStream(org.apache.servicecomb.foundation.vertx.tcp.TcpOutputStream)

Aggregations

TcpOutputStream (org.apache.servicecomb.foundation.vertx.tcp.TcpOutputStream)11 Buffer (io.vertx.core.buffer.Buffer)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)2 ByteBuf (io.netty.buffer.ByteBuf)1 Endpoint (org.apache.servicecomb.core.Endpoint)1 LoginRequest (org.apache.servicecomb.transport.highway.message.LoginRequest)1 RequestHeader (org.apache.servicecomb.transport.highway.message.RequestHeader)1