2017-02-13 87 views
0

我們使用Akka框架進行進程間通信。幾天前,QA團隊發現了一些陷入僵局的請求。對於某些請求,不調用onSuccess()和onFailure()回調方法。日誌的最後一行顯示爲akka future onsuccess onfailure都沒有執行

"Charging Customer." 

並且該特定事務的流程停在那裏。下一個日誌應該是

"Charging response or Charging Failed" 

這種行爲的原因是什麼?這可能是由於調度員被堵塞?我們正在使用默認的調度程序。

代碼

log.debug("Charging Customer"); 
Future future = Patterns.ask(actorSelection, new Gson().toJson(request), timeout); 
future.onSuccess(new onChargingSuccess<>(ccRequest), context().system().dispatcher()); 
future.onFailure(new onFailureHandler(ccRequest), context().system().dispatcher()); 


private class onChargingSuccess<T> extends OnSuccess<T> { 
@Override 
public void onSuccess(T t) throws Throwable { 
     log.debug("Charging response:" + t.toString()); 
} 

private class onFailureHandler extends OnFailure { 
@Override 
    public void onFailure(Throwable thrwbl) throws Throwable { 
     log.info("Charging Failed"); 
} 
+0

'timeout'有多長?你有沒有證實日誌輸出是可見的? –

+0

超時時間爲15秒。記錄超時請求。日誌輸出在文件中可見。 –

回答

0

那麼它不是一個真正的解決方案,但在重新啓動解決了該問題的模塊。該模塊運行了一年。我知道現在這使得它成爲一個非常普遍的問題,但我會把它留在這裏,以防萬一我們挖掘實際問題並找到解決方案。我會在這種情況下更新。