简体   繁体   English

使用com.sun.net.httpserver.HttpServer进行Comet / cometd

[英]Using com.sun.net.httpserver.HttpServer for comet/cometd

I would to use com.sun.net.httpserver.HttpServer to do comet/cometd. 我会使用com.sun.net.httpserver.HttpServer来做彗星/彗星。 I am wondering how tough it is to do it so that I can take the waiting connections off the thread and into some waiting queue. 我想知道这样做有多难,这样我就可以将等待的连接从线程中断开,并进入一些等待的队列中。

Also, am I correct in that it looks like it is using nio? 另外,我是否正确,因为它看起来像在使用nio?

Also, is there any better examples? 另外,还有更好的例子吗? I always get caught up in the terminology that the javadoc uses... 我总是被javadoc使用的术语所困扰...

Thanks :) 谢谢 :)

After going in and looking at the source (See, Open Source is a good thing :) ), I can see that there really isn't a way to take the pending response off the thread. 在查看了源代码之后(参见Open Source是一件好事:)),我可以看到确实没有办法将待处理的响应从线程中删除。 Because it has a filter chain, there really isn't a mechanism for it to leave cleanly and then come back to it. 因为它具有过滤器链,所以实际上没有一种机制可以使它干净地离开然后再回到它上面。 I would either need to remove the filter chain, split filters into two pieces, or require them to manage state so that it can leave and come back.... 我要么需要删除过滤器链,将过滤器分成两部分,要么要求他们管理状态,以便它可以离开并返回。

I think for now by task is small enough that I can just let them sit on the stack. 我认为目前按任务计的规模很小,我只能让他们坐在堆栈上。 So my search for a simple, clean implement ion continues... 因此,我继续寻找一种简单,干净的工具离子...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM