WsRemoteEndpointImplBase.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:tomcat7 作者:
void endMessage(SendHandler handler, SendResult result) {
    boolean doWrite = false;
    MessagePart mpNext = null;
    synchronized (messagePartLock) {

        fragmented = nextFragmented;
        text = nextText;

        mpNext = messagePartQueue.poll();
        if (mpNext == null) {
            messagePartInProgress = false;
        } else if (!closed){
            // Session may have been closed unexpectedly in the middle of
            // sending a fragmented message closing the endpoint. If this
            // happens, clearly there is no point trying to send the rest of
            // the message.
            doWrite = true;
        }
    }
    if (doWrite) {
        // Actual write has to be outside sync block to avoid possible
        // deadlock between messagePartLock and writeLock in
        // o.a.coyote.http11.upgrade.AbstractServletOutputStream
        writeMessagePart(mpNext);
    }

    wsSession.updateLastActive();

    // Some handlers, such as the IntermediateMessageHandler, do not have a
    // nested handler so handler may be null.
    if (handler != null) {
        handler.onResult(result);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号