我正在使用JTOpen ProgramCall類(com.ibm.as400.access.ProgramCall)調用IBM i(AS/400)上的程序的Web應用程序(運行於Tomcat上)。我的問題是程序調用需要超過30秒才能響應,這觸發java.net.SocketTimeoutException: Read timed out exception
。JTOpen ProgramCall Socket Timeout
有一個setTimeout()
方法可用於此類,但它似乎沒有影響套接字超時。我也檢查了我的Tomcat配置,並沒有看到任何會導致此行爲的東西。
有誰知道一種方法來改變這種實現的超時?
代碼:
pgmCall.setProgram(getCompleteName(), parmList);
initializeAS400TextParameters();
// Run the AS/400 program.
try {
Trace.setTraceDiagnosticOn(true);
Trace.setTraceInformationOn(true);
Trace.setTraceWarningOn(true);
Trace.setTraceErrorOn(true);
Trace.setTraceDatastreamOn(true);
if (pgmCall.run() != true) {
messageList = pgmCall.getMessageList();
for (int i = 0; i < messageList.length; i++) {
log.debug("Error Message " + i + " " + messageList[i]);
}
setCompletionMsg("Program call failed.");
log.debug("442 Program call failed.");
return false;
} else {
messageList = pgmCall.getMessageList();
for (int i = 0; i < messageList.length; i++) {
log.debug("Success Message " + i + " " + messageList[i]);
}
setCompletionMsg("Program called ok.");
log.debug("452 Program called ok.");
return true;
}
} catch (Exception e) {
// This is where the timeout exception is thrown
log.debug("Error Running Program: " + e.getMessage() + " " + e.getLocalizedMessage());
setCompletionMsg(e.getMessage());
}