in src/Apache.IoTDB/SessionPool.cs [152:205]
public async Task<TResult> ExecuteClientOperationAsync<TResult>(AsyncOperation<TResult> operation, string errMsg, bool retryOnFailure = true, bool putClientBack = true)
{
Client client = _clients.Take();
try
{
var resp = await operation(client);
return resp;
}
catch (TException ex)
{
if (retryOnFailure)
{
try
{
client = await Reconnect(client);
return await operation(client);
}
catch (TException retryEx)
{
throw new TException(errMsg, retryEx);
}
}
else
{
throw new TException(errMsg, ex);
}
}
catch (Exception ex)
{
if (retryOnFailure)
{
try
{
client = await Reconnect(client);
return await operation(client);
}
catch (TException retryEx)
{
throw new TException(errMsg, retryEx);
}
}
else
{
throw new TException(errMsg, ex);
}
}
finally
{
if (putClientBack)
{
_clients.Add(client);
}
}
}