Exemplo n.º 1
0
        /// <inheritdoc/>
        public override Task <bool> Shutdown()
        {
            var stopTask          = manager.GracefulStop((RARP.For(System).Provider).RemoteSettings.FlushWait);
            var transportStopTask = WrappedTransport.Shutdown();

            return(Task.WhenAll(stopTask, transportStopTask).ContinueWith(x => x.IsCompleted && !(x.IsFaulted || x.IsCanceled), TaskContinuationOptions.ExecuteSynchronously));
        }
Exemplo n.º 2
0
        public override Task <bool> Shutdown()
        {
            var stopTask          = manager.GracefulStop(((RemoteActorRefProvider)((ActorSystemImpl)System).Provider).RemoteSettings.FlushWait);
            var transportStopTask = WrappedTransport.Shutdown();

            return(Task.WhenAll(stopTask, transportStopTask).ContinueWith(x => x.IsCompleted, TaskContinuationOptions.ExecuteSynchronously));
        }
Exemplo n.º 3
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="message">TBD</param>
        /// <returns>TBD</returns>
        public override Task <bool> ManagementCommand(object message)
        {
            if (message is SetThrottle)
            {
                return(manager.Ask(message, AskTimeout).ContinueWith(r =>
                {
                    return r.Result is SetThrottleAck;
                }));
            }

            if (message is ForceDisassociate || message is ForceDisassociateExplicitly)
            {
                return(manager.Ask(message, AskTimeout).ContinueWith(r => r.Result is ForceDisassociateAck,
                                                                     TaskContinuationOptions.ExecuteSynchronously));
            }

            return(WrappedTransport.ManagementCommand(message));
        }
Exemplo n.º 4
0
        /// <summary>
        /// TBD
        /// </summary>
        /// <param name="message">TBD</param>
        /// <returns>TBD</returns>
        public override Task <bool> ManagementCommand(object message)
        {
            if (message is All)
            {
                var all = message as All;
                _allMode = all.Mode;
                return(Task.FromResult(true));
            }

            if (message is One)
            {
                var one = message as One;
                //  don't care about the protocol part - we are injected in the stack anyway!
                addressChaosTable.AddOrUpdate(NakedAddress(one.RemoteAddress), address => one.Mode, (address, mode) => one.Mode);
                return(Task.FromResult(true));
            }

            return(WrappedTransport.ManagementCommand(message));
        }
Exemplo n.º 5
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="remoteAddress">TBD</param>
 /// <param name="statusPromise">TBD</param>
 /// <exception cref="FailureInjectorException">TBD</exception>
 protected override void InterceptAssociate(Address remoteAddress, TaskCompletionSource <AssociationHandle> statusPromise)
 {
     // Association is simulated to be failed if there was either an inbound or outbound message drop
     if (ShouldDropInbound(remoteAddress, new object(), "interceptAssociate") ||
         ShouldDropOutbound(remoteAddress, new object(), "interceptAssociate"))
     {
         statusPromise.SetException(
             new FailureInjectorException("Simulated failure of association to " + remoteAddress));
     }
     else
     {
         WrappedTransport.Associate(remoteAddress).ContinueWith(tr =>
         {
             var handle = tr.Result;
             addressChaosTable.AddOrUpdate(NakedAddress(handle.RemoteAddress), address => PassThru.Instance,
                                           (address, mode) => PassThru.Instance);
             statusPromise.SetResult(new FailureInjectorHandle(handle, this));
         }, TaskContinuationOptions.ExecuteSynchronously);
     }
 }
Exemplo n.º 6
0
 public override Task <bool> ManagementCommand(object message)
 {
     return(WrappedTransport.ManagementCommand(message));
 }