...
ID | IEP-82 | ||||||||
Author | Pavel Tupitsyn | ||||||||
Sponsor | Pavel Tupitsyn | ||||||||
Created |
| ||||||||
Status |
|
Table of Contents |
---|
Code Block | ||||
---|---|---|---|---|
| ||||
while (maxRetries-- > 0) { try { cache.Put(1, "Hello"); break; } catch (Exception e) when (e.GetBaseException() is SocketException) { // Retry. } } |
All changes are on the client side, server is not affected.
...
Code Block | ||
---|---|---|
| ||
ClientConfiguration cfg = new ClientConfiguration() .setRetryPolicy(new ClientRetryReadPolicy()); Ignition.startClient(cfg); |
An interface is a good choice for Java and C# thin clients. For other languages, like C++ and Python, we may consider a different approach, such as a callback or a function pointer.
Ideally, we could pass more information to the shouldRetry method: cache keys and values, SQL query text, and so on, according to the operation at hand. However, this will require extra heap allocations - for every client method call, we'll need to store the arguments somewhere. This means overhead for the entire thin client API, which is not acceptable. We could also make this behavior optional with a property like ClientRetryPolicy.requiresArguments. For now, this is considered out of scope.
// Links to discussions on the devlist, if applicable.
// TODO: Links or report with relevant JIRA tickets.