阿帕奇美娜 - 2.0.1Apache的MINA時段收盤迴調
我有一個IoHandlerAdapter其中有呼籲sessionOpened和sessionClosed背影。當我打開一個會話,我登錄到服務器並開始發送請求,在「sessionClosed」我只是重新啓動我的應用程序。
我的應用程序進行檢查
if(!session.isClosing()) {
//write to socket
} else {
//throw a runtime exception. Hopefully the sessionClosed API gets
//called soon and the next time this call will succeed.
}
但是我也注意到,雖然session.isClosing()返回true會話實際上永遠不會被關閉。即我真的不會在我的處理程序中接到回電。這可能嗎?我怎樣才能減輕這種風險。有人可以解釋關閉回調被調用需要多長時間嗎?