In general, using request timeouts is discouraged to prevent the possibility of lost updates (a general issue with HTTP client timeouts). When a PUT request times out, it may eventually perform on the server side. Before this delayed execution, if there is another PUT request for the same object, that update is overwritten by the delayed first request (this process causes a DL risk). To avoid this possibility, you can disable request timeouts in the client. This process avoids any possibility of an unexpected delayed execution.
NOTE: Disabling request timeouts does not prevent concurrent issues. If there are multiple threads attempt to PUT the same object, the system executes the last update. It is the responsibility of an application to provide any locking mechanisms for concurrent access.
In ECS Java SDK Client version 3.1.3 and below, the timeout parameter value is set as one minute, which has a potential DL risk of lost updates.
In ECS Java SDK Client version 3.2.0 and above, the timeout parameter is disabled by default.
From ECS 3.5.1.4, as an alternative to disabling the timeout parameter, you can add
IfNoneMatch and
IfMatch parameters in the request header. This can be used as an optimistic locking mechanism.
For example,
You can add headers using the below command. This command creates the object when there is no such objects.
request.withIfMatch(null).withIfNoneMatch("*")
If you want to update an object sequentially, you can use the below command to ensure that the update follows the previous update.