2.0以下mina信息接收不全解决方案
接收不全是因为readBufSize不够,会分批接收。。
作为业务来说不好分析。
1.将一次session所有 接收的wrap起来。。
public void sessionCreated(IoSession session) throws Exception { super.sessionCreated(session); //一次读的缓存大小,不然消息会分批接收 hackReadBufSize(session, 8* 1024); } /** * hack无权限类相关域 */ private void hackReadBufSize(IoSession session, int readBuf) { try { Method method = session.getClass().getDeclaredMethod("setReadBufferSize", int.class); method.setAccessible(true); method.invoke(session, readBuf); } catch (Exception e) { } }如此而已。。