GWT Asynchronouscallback超时问题:始终进入OnFailure()

时间:2013-05-17 11:00:32

标签: json gwt asynchronous rpc gwt-rpc

我是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);

任何帮助都将不胜感激。

0 个答案:

没有答案