在 Web 應用程式中,類的定義如下:
public class ThreadSession {
private static final int MAX_AVAILABLE = 1;
static private final Semaphore semaphore = new Semaphore(MAX_AVAILABLE, true);
然后有一個或多個執行緒由以下人員創建:
class wsClientThread extends Thread {
public void run() { ... }
...
wsClientThread clientThread = new wsClientThread(clientSocket);
clientThread.start();
我們將這些執行緒稱為 A、B、..
在這些訪問 ThreadSession.semaphore 的執行緒內部按預期作業正常,但是在重新部署 web 應用程式(通過 jboss 4.05)并重新加載我的 index.jsp 后,執行緒 A、B、.. ThreadSession.semaphore 為空(但 ThreadSession.semaphore 為空)。 MAX_AVAILABLE = 1)
不明白為什么會這樣..有人可以幫助我嗎?
謝謝克里斯蒂安
uj5u.com熱心網友回復:
經過幾次測驗后,問題消失了,我認為這是由于應用程式服務器(jboss 4)中的一些不穩定造成的
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/430570.html