0

首先,我有一个 JSF 应用程序,它从数据库中进行某种搜索,但另一方面,我也一直在为此目的监听端口,我在我的应用程序 bean 中启动了一个监听该端口的线程。我从该端口侦听这些搜索的传入请求并从该端口发送响应。情况是我的响应时间出乎意料地变化,我从端口发送/获取,但是从我的网页上我的性能保持稳定,尽管它们使用相同的对象。

我的问题是,我的网络服务器会阻碍我从我的网络应用程序独立运行的进程吗?

4

1 回答 1

1

The web container will probably have a thread pool, and the app server probably has its own background threads too, so your thread is contentending with those threads for resources (not least CPU) so at that level interference is possible. The actual thread scheduling will be done by the JVM and that may depend upon whatever priorities are set. Java EE app servers don't encourage you start your own worker threads, and some provide architected ways of doing so, I would favour doing that.

Of course the Web App threads and your thread in using the same business objects may also contend, but there at least you should be an equal citizen.

于 2009-11-13T20:18:01.907 回答