我是 GWT 的新手。我编写了一段代码,它对服务器进行异步调用。从日志中可以看出,服务器端代码运行良好。但在客户端,我收到一条失败消息。
我正在尝试从服务器加载大量数据。在从服务器返回整个数据之前,异步调用似乎超时。有没有办法增加通话的超时时间?或者我的代码还有其他问题吗?
public MapDataServiceFacadeAsync getMapDataServiceInstance()
{
if (mapDataService == null)
{
mapDataService = MapDataServiceFacade.Util.getInstance();
}
return mapDataService;
public void setTreeInstance(final String productName, final Object invObject, final boolean isToLoadTickets, final SearchItem search)
{
refreshSearch = search;
this.inventoryMapPanel = (InventoryMapPanel) invObject;
long startTime = System.currentTimeMillis();
getMapDataServiceInstance().getProductTree(userProfile, isToLoadTickets, search, new AsyncCallback()
{
public void onFailure(Throwable caught)
{
CommonMapUI.loadLabel(false);
Window.alert("Failed to Load Tree. Please try again");
}
public void onSuccess(Object result)
{
tmpData = (MapItem[]) ((HashMap) result).get("tree");
if (tmpData == null && Count < 3)
{
Count++;
setTreeInstance(productName, invObject, isToLoadTickets, search);
}
else
{
buildProductTree(result, invObject, isToLoadTickets);
}
}
});
}
如果我尝试检索大量数据,它总是抛出错误“加载树失败”。如果要加载少量数据,它可以正常工作。
界面:
public interface MapDataServiceFacadeAsync {
public void getProductTree(CommonUserProfile user, boolean isToLoadTickets,SearchItem search, AsyncCallback asynCall);
任何帮助,将不胜感激。