cezarypiatekGC commented on a change in pull request #4: [WIP] Failover
implementation
URL: https://github.com/apache/activemq-nms-amqp/pull/4#discussion_r301105552
##########
File path: src/NMS.AMQP/Provider/Failover/FailoverRequest.cs
##########
@@ -0,0 +1,100 @@
+using System;
+using System.IO;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Apache.NMS.AMQP.Provider.Failover
+{
+ public class FailoverRequest
+ {
+ private readonly FailoverProvider failoverProvider;
+ private readonly TaskCompletionSource<bool> taskCompletionSource;
+
+ public FailoverRequest(FailoverProvider failoverProvider, long
requestTimeout)
+ {
+ this.failoverProvider = failoverProvider;
+
+ this.taskCompletionSource = new
TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
+ if (requestTimeout != ConnectionInfo.INFINITE)
+ {
+ CancellationTokenSource ct = new
CancellationTokenSource(TimeSpan.FromMilliseconds(requestTimeout));
Review comment:
Consider invoking this timeout registration only if the first invocation
fails. Add an option to cancel this timeout handling if the operation success
before timeout has been reached. Provide appropriate handling of
`CancellationTokenSource` disposal.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services