Can long-polling be achieved in Restlet by just making the thread sleep?

瘦欲@ 提交于 2019-12-12 17:24:00

问题


When making a GET request for a particular resource (i.e. ServerResource) if I put the thread to sleep (to simulate long-polling) what would happen? Does the framework support this? From a Java EE standpoint what are the side-effects? Does it scale well with Tomcat (or any other server?)

Has any-one tried implementing long-polling using Restlet by just making the request thread sleep?

It seems restlet has no support for comet-style web applications and hence the question of such a hack, so to speak.


回答1:


Blocking a thread is possible as long as you don't need a huge number of concurrent connections in which case this will cause a scalability issue.

In version 2.1 of the Restlet Framework edition for JavaSe, the internal non-blocking NIO connector has added such capabilities (handling any number of connections with a limited thread pool) even though it isn't fully stable and documented yet.



来源:https://stackoverflow.com/questions/9051723/can-long-polling-be-achieved-in-restlet-by-just-making-the-thread-sleep

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!