tyrus connectToServer‘握手响应未收到’
如何在没有创建越来越多的守护进程、灰熊内核和灰熊工作线程的情况下重新尝试连接。有没有调用会话或客户端来杀死/清理线程1到4以及灰熊内核和灰熊工作线程?
例如JAVA主线,它试图永远建立和维护与服务器的连接,该服务器可能没有运行,也可能定期重新启动。
public void onClose(Session session, CloseReason closeReason) {
latch.countDown();
}
enter code here
public static void main(String[] args) {
while (true) {
latch = new CountDownLatch(1);
ClientManager client = ClientManager.createClient();
try {
client.connectToServer(wsListener.class, new URI("wss://<host>/ws"));
latch.await();
}
catch (DeploymentException e) {
try {
Thread.sleep(1000);
} catch (InterruptedException ie) {
break;
}
}
catch (Exception e) {
throw new RuntimeException(e);
}
client = null;
latch = null;
// HERE... clean up
}
}发布于 2014-01-03 08:17:53
发布于 2014-03-05 08:18:48
我也有同样的行为。我使用了大量的线程和同步,并设法意外地获得了onOpen方法的ClientEndpoint阻塞,这导致握手超时。
https://stackoverflow.com/questions/19274265
复制相似问题