j2ssh v0.2.9对于并发多个客户端存在问题,总是报List越界
现象:
List越界
原因:
SshMsgKexInit类中的sortAlgorithmList,list.remove(pref)时,list为普通ArrayList,并发存取有问题。
解决方法:
com.sshtools.j2ssh.transport.cipher.SshCipherFactory.java中的static {}中的变量supported初始化改为
supported = Collections.synchronizedList(new ArrayList(ciphers.keySet()));
这样并发就没问题了。