0
有一個Java應用程序,該應用程序對執行某些sql查詢的ruby應用程序進行http調用,並且如果成功,則返回http響應200到java應用程序,我的問題是ruby應用程序需要花費5分鐘以上才能完成執行,同時在接近3分鐘後檢查java應用程序的日誌,並將其作爲網關超時異常。如何解決此問題?如何通過增加http響應時間來避免網關超時異常
的Java HTTP調用Ruby應用程序:
GetMethod get = new GetMethod(URL to ruby application);
Exception exception = null;
try {
// Get HTTP client
HttpClient httpclient = new HttpClient();
int resultCode = httpclient.executeMethod(get);
// Display status code
if (log.isInfoEnabled()) {
log.info("response status code: "
+ resultCode);
// Display response
log.info("Response body: " + get.getResponseBodyAsString());
}
if (resultCode != 200) {
log.error("Failed with status code: "
+ resultCode);
log.error("Response body: " + get.getResponseBodyAsString());
}
}