Invocation Timeouts

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

An invocation timeout limits how long Ice waits for an invocation to complete. When the timeout expires, the invocation fails with InvocationTimeoutException.

Ice starts the timer once it has marshaled the request parameters, before it obtains a connection, cached or newly established. For a twoway invocation, it stops the timer when it receives the reply, before it unmarshals the reply. For a oneway invocation, it stops the timer once it has sent the request. The timeout applies to the invocation as a whole, retries included.

Ice.Default.InvocationTimeout sets the default invocation timeout of proxies, in milliseconds. Its default value, -1, means no timeout. Ice does not marshal the invocation timeout with a proxy: a proxy unmarshaled from a request or a reply gets the default invocation timeout of the receiving communicator.

The InvocationTimeout proxy property sets the timeout of the proxy that propertyToProxy creates:

Properties
Greeter.Proxy=greeter:tcp -h localhost -p 4061
Greeter.Proxy.InvocationTimeout=2500

The ice_invocationTimeout proxy factory method returns a new proxy with the given timeout:

C++
VisitorCenter::GreeterPrx greeter{communicator, "greeter:tcp -h localhost -p 4061"};
greeter = greeter.ice_invocationTimeout(2500ms);
C#
var greeter = GreeterPrxHelper.createProxy(
communicator,
"greeter:tcp -h localhost -p 4061");
greeter = GreeterPrxHelper.uncheckedCast(
greeter.ice_invocationTimeout(TimeSpan.FromMilliseconds(2500)));
Java
var greeter = GreeterPrx.createProxy(communicator, "greeter:tcp -h localhost -p 4061");
greeter = greeter.ice_invocationTimeout(Duration.ofMillis(2500));
JavaScript
var greeter = new VisitorCenter.GreeterPrx(
communicator,
"greeter:tcp -h localhost -p 4061");
greeter = greeter.ice_invocationTimeout(2500);
MATLAB
greeter = GreeterPrx(communicator, 'greeter:tcp -h localhost -p 4061');
greeter = greeter.ice_invocationTimeout(2500);
PHP
$greeter = GreeterPrxHelper::createProxy(
$communicator,
'greeter:tcp -h localhost -p 4061');
$greeter = $greeter->ice_invocationTimeout(2500);
Python
greeter = GreeterPrx(communicator, "greeter:tcp -h localhost -p 4061")
greeter = greeter.ice_invocationTimeout(2500)
Ruby
greeter = GreeterPrx.new(communicator, "greeter:tcp -h localhost -p 4061")
greeter = greeter.ice_invocationTimeout(2500)
Swift
var greeter = try makeProxy(
communicator: communicator,
proxyString: "greeter:tcp -h localhost -p 4061",
type: GreeterPrx.self)
greeter = greeter.ice_invocationTimeout(2500)

An invocation timeout affects only the client: Ice does not notify the server, which can still be dispatching the request, and Ice ignores the reply if the server sends one. Ice does not retry an invocation that times out.