Howto modify connection timeout for AdminPrx?

jharriotjharriot Member John HarriottOrganization: BAE SystemsProject: P3 Mid Life Upgrade ✭✭
Hi,

Setup: Ice version 3.3.1, VS 2009, Windows XP, Language C#.

I'm manually starting servers using IceGrid Admin and I notice the server must startup before the Ice connection timeout is exceeded.

I currently use Ice.Override.Timeout and I want to keep it small to keep the system responsive. However, I would like a larger value when starting servers.

Is it possible to modify the timeout value for an AdminPrx object?

I tried the following (see code snippet below) without success, i.e. an ObjectNotExistException is thrown when I invoke admin.

IceGrid.AdminPrx admin;
IceGrid.AdminSessionPrx session;

... setup session code here

admin = session.getAdmin();
ObjectPrx prx = this.admin.ice_timeout(10000);
this.admin = AdminPrxHelper.checkedCast(prx);


Regards John

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi John,

    As its name implies, the Ice.Override.Timeout property overrides any timeouts that are configured for individual proxies, so calling ice_timeout in this situation will have no effect.

    I'm guessing that you're setting Ice.Override.Timeout because your program uses a lot of proxies and it's easier to set this property than to configure each proxy individually. Although it's not ideal, one possible workaround is to create a second communicator that you would only use to start servers. This would let you use a more suitable timeout.

    We'll see if we can improve this situation in a future Ice release.

    Regards,
    Mark
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Bernard reminded me of another option. The timeout that is configured in an object adapter endpoint is embedded by default in the proxies created by that object adapter. Since the timeout value is part of a proxy's marshaled state, this value is also transferred to any recipients of the proxy. The receiver will then use the proxy's default timeout (assuming the receiver hasn't set Ice.Override.Timeout, of course).

    For example:

    MyAdapter.Endpoints=tcp -t 10000

    This sets a default timeout value of 10 seconds for all proxies created by MyAdapter.

    In the case of the IceGrid Admin object, you can set a default timeout in the IceGrid.Registry.Client.Endpoints property and then use ice_timeout to configure a longer timeout when starting servers.

    Keep in mind that to eliminate the need for Ice.Override.Timeout altogether, you would have to add default timeouts to the endpoint configurations of all object adapters that create proxies used by your client.

    Regards,
    Mark
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi John,
    jharriot wrote: »
    I currently use Ice.Override.Timeout and I want to keep it small to keep the system responsive.

    A small timeout in itself is not going to make your system more responsive. It will just alert you quickly if your system isn't (you'll get timeout exceptions and will need to handle them). Ice treats timeouts as severe exceptions and closes the associated connection.

    If you're making remote invocations in a GUI application, and you don't want this GUI to freeze too long (because a synchronous invocation in the GUI thread is taking more time than it should), then using timeouts is not a great solution: you should instead switch to asynchronous invocations (AMI) from this GUI thread.

    All the best,
    Bernard
Sign In or Register to comment.