Dear gurus,

I'm learning Java and GWT and I'm facing a problem with setting timeout for
PRC calls. I want to extend the RPC timeout before the client reports a
failure. The code I'm using is attached below.

I'm running a client in firefox and experience the following problem:

I want to achieve a timeout of 20-30 seconds. However I can set the timeout
(RPC_TIMEOUT_MS) only up to 3200mS. In case the server does not respond I
receive the exception "*com.google.gwt.http.client.RequestTimeoutException:
A request timeout has expired after 3200 ms*" accurately after defined time.

However in case set timeout exceeds the 3300ms of above the exception is
different "*com.google.gwt.user.client.rpc.StatusCodeException: 0*" and is
thrown always after 3-4 seconds.

What causes this exception and how can I extend the waiting time?

Thank you,
Best regards
Dmitri

The code:
public class MyClass implements EntryPoint {

  private static final int RPC_TIMEOUT_MS = 3300;

  private static class TimeoutRequestBuilder extends RpcRequestBuilder {
    @Override
    protected RequestBuilder doCreate(String serviceEntryPoint) {
  RequestBuilder builder = super.doCreate(serviceEntryPoint);
      builder.setTimeoutMillis(RPC_TIMEOUT_MS);
      return builder;
    }
  }

  private static final RpcRequestBuilder requestBuilder = new
TimeoutRequestBuilder();
  private final HubServiceAsync myService = GWT.create(HubService.class);

  @Override
  public void onModuleLoad() {
    ((ServiceDefTarget) hmyService).setRpcRequestBuilder(requestBuilder);

    final MainView mainView = new MainView(hubService);

    RootPanel rootPanel = RootPanel.get();
    rootPanel.add(mainView);

    Window.addResizeHandler(new ResizeHandler() {
      @Override
      public void onResize(ResizeEvent event) {
        mainView.resize();
      }
    });
  }
}

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/CADg%3D4kYt_6AaBghGxUoB_HYiaLumFCXEcrmm%3Dacd9wvPYZY4BQ%40mail.gmail.com.

Reply via email to