---
title: "Invocation Timeouts"
url: https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts
language: java
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Invocation Timeouts

Programming language: Java. Other languages: [C++](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/csharp.md), [JavaScript](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/php.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/ruby.md), [Swift](https://docs.zeroc.com/ice/3.8/runtime/invocation/invocation-timeouts/swift.md).

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](https://docs.zeroc.com/ice/3.8/runtime/invocation/automatic-retries/java.md) included.

## Configuring Invocation Timeouts

[Ice.Default.InvocationTimeout](https://docs.zeroc.com/ice/3.8/property-reference/ice-default-properties/java.md#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](https://docs.zeroc.com/ice/3.8/property-reference/proxy-properties/java.md#name.invocationtimeout) proxy property sets the timeout of the proxy that [propertyToProxy](https://docs.zeroc.com/ice/3.8/runtime/invocation/creating-proxies/java.md) creates:

```config
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:

```java
var greeter = GreeterPrx.createProxy(communicator, "greeter:tcp -h localhost -p 4061");
greeter = greeter.ice_invocationTimeout(Duration.ofMillis(2500));
```

## When an Invocation Times Out

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](https://docs.zeroc.com/ice/3.8/runtime/invocation/automatic-retries/java.md) an invocation that times out.

## See Also

- [Proxy Properties](https://docs.zeroc.com/ice/3.8/property-reference/proxy-properties/java.md)
- [Ice.Default.\*](https://docs.zeroc.com/ice/3.8/property-reference/ice-default-properties/java.md)
- [Obtaining Proxies](https://docs.zeroc.com/ice/3.8/runtime/invocation/creating-proxies/java.md)
