Java WebSockets: The remote endpoint was in state [TEXT_FULL_WRITING]

2018-02-27 11:50:48来源:oschina作者:ryanzl人点击

分享

java Websocket 多线程向同一个session写数据,容器为tomcat


目前发现的问题是tomcat的一个bug,解决方案是:


public void sendMessage(String message) throws IOException {
synchronized(this.session) {
this.session.getBasicRemote().sendText(message);
}
//this.session.getAsyncRemote().sendText(message);
}

使用synchronized和getBasicRemote,使用getAsyncRemote的话也会报错

https://stackoverflow.com/questions/22257079/java-websockets-the-remote-endpoint-was-in-state-text-full-writing


https://bz.apache.org/bugzilla/show_bug.cgi?id=56026


https://www.cnblogs.com/interdrp/p/4866129.html


http://blog.csdn.net/luoruixiaohai/article/details/50960319


https://stackoverflow.com/questions/33381420/tomcat-throws-the-remote-endpoint-was-in-state-binary-full-writing-when

最新文章

123

最新摄影

闪念基因

微信扫一扫

第七城市微信公众平台