Example #1
0
 private void SendDisassociate(AssociationHandle wrappedHandle, DisassociateInfo info)
 {
     try
     {
         wrappedHandle.Write(_codec.ConstructDisassociate(info));
     }
     catch (Exception ex)
     {
         throw new AkkaProtocolException("Error writing DISASSOCIATE to transport", ex);
     }
 }
Example #2
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="reason">TBD</param>
 /// <returns>TBD</returns>
 public override ByteString ConstructDisassociate(DisassociateInfo reason)
 {
     switch (reason)
     {
         case DisassociateInfo.Quarantined:
             return DISASSOCIATE_QUARANTINED;
         case DisassociateInfo.Shutdown:
             return DISASSOCIATE_SHUTTING_DOWN;
         case DisassociateInfo.Unknown:
         default:
             return DISASSOCIATE;
     }
 }
Example #3
0
        private Exception DisassociateException(DisassociateInfo info)
        {
            switch (info)
            {
            case DisassociateInfo.Shutdown:
                return(new AkkaProtocolException("The remote system refused the association because it is shutting down."));

            case DisassociateInfo.Quarantined:
                return(new AkkaProtocolException("The remote system has quarantined this system. No further associations to the remote systems are possible until this system is restarted."));

            case DisassociateInfo.Unknown:
            default:
                return(new AkkaProtocolException("The remote system explicitly disassociated (reason unknown)."));
            }
        }
Example #4
0
 public Disassociate(DisassociateInfo reason)
 {
     Reason = reason;
 }
Example #5
0
 public abstract ByteString ConstructDisassociate(DisassociateInfo reason);
Example #6
0
 public Disassociated(DisassociateInfo info)
 {
     Info = info;
 }
Example #7
0
 private IHandleEvent testDisassociate(DisassociateInfo info)
 {
     return(new InboundPayload(codec.ConstructDisassociate(info)));
 }
Example #8
0
 public InvalidAssociation(Address localAddress, Address remoteAddress, Exception cause = null, DisassociateInfo? disassociateInfo = null)
     : base(string.Format("Invalid address: {0}", remoteAddress), cause)
 {
     RemoteAddress = remoteAddress;
     LocalAddress = localAddress;
     DisassociationInfo = disassociateInfo;
 }
Example #9
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="failReason">TBD</param>
 public FailWith(DisassociateInfo failReason)
 {
     FailReason = failReason;
 }
Example #10
0
 private void HandleDisassociated(DisassociateInfo info)
 {
     switch (info)
     {
         case DisassociateInfo.Quarantined:
             throw new InvalidAssociation(LocalAddress, RemoteAddress, new InvalidAssociationException("The remote system has quarantined this system. No further associations " +
                                                                                                       "to the remote system are possible until this system is restarted."));
         case DisassociateInfo.Shutdown:
             throw new ShutDownAssociation(LocalAddress, RemoteAddress, new InvalidAssociationException("The remote system terminated the association because it is shutting down."));
         case DisassociateInfo.Unknown:
         default:
             Context.Stop(Self);
             break;
     }
 }
Example #11
0
 public abstract ByteString ConstructDisassociate(DisassociateInfo reason);
Example #12
0
 private IHandleEvent testDisassociate(DisassociateInfo info) { return new InboundPayload(codec.ConstructDisassociate(info)); }
Example #13
0
 public void Disassociate(DisassociateInfo info)
 {
     StateActor.Tell(new DisassociateUnderlying(info));
 }
Example #14
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="info">TBD</param>
 public DisassociateUnderlying(DisassociateInfo info = DisassociateInfo.Unknown)
 {
     Info = info;
 }
Example #15
0
        protected override void Unhandled(object message)
        {
            if (message is Terminated)
            {
                var t = message as Terminated;
                if (_reader == null || t.ActorRef.Equals(_reader))
                {
                    PublishAndThrow(new EndpointDisassociatedException("Disassociated"), LogLevel.DebugLevel);
                }
            }
            else if (message is StopReading)
            {
                var stop = message as StopReading;
                if (_reader != null)
                {
                    _reader.Tell(stop, stop.ReplyTo);
                }
                else
                {
                    // initializing, buffer and take care of it later when buffer is sent
                    EnqueueInBuffer(message);
                }
            }
            else if (message is TakeOver)
            {
                var takeover = message as TakeOver;

                // Shutdown old reader
                _handle.Disassociate();
                _handle = takeover.ProtocolHandle;
                takeover.ReplyTo.Tell(new TookOver(Self, _handle));
                Context.Become(Handoff);
            }
            else if (message is FlushAndStop)
            {
                _stopReason = DisassociateInfo.Shutdown;
                Context.Stop(Self);
            }
            else if (message is OutboundAck)
            {
                var ack = message as OutboundAck;
                _lastAck = ack.Ack;
                if (_ackDeadline.IsOverdue)
                    TrySendPureAck();
            }
            else if (message is AckIdleCheckTimer || message is FlushAndStopTimeout || message is BackoffTimer)
            {
                //ignore
            }
            else
            {
                base.Unhandled(message);
            }
        }
Example #16
0
 private void DoFlushAndStop()
 {
     //Try to send last Ack message
     TrySendPureAck();
     _stopReason = DisassociateInfo.Shutdown;
     Context.Stop(Self);
 }
Example #17
0
 public override ByteString ConstructDisassociate(DisassociateInfo reason)
 {
     switch (reason)
     {
         case DisassociateInfo.Quarantined:
             return DISASSOCIATE_QUARANTINED;
         case DisassociateInfo.Shutdown:
             return DISASSOCIATE_SHUTTING_DOWN;
         case DisassociateInfo.Unknown:
         default:
             return DISASSOCIATE;
     }
 }
Example #18
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="reason">TBD</param>
 public void DisassociateWithFailure(DisassociateInfo reason)
 {
     ThrottlerActor.Tell(new ThrottledAssociation.FailWith(reason));
 }
Example #19
0
 public Disassociate(DisassociateInfo reason)
 {
     Reason = reason;
 }
Example #20
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="address">TBD</param>
 /// <param name="reason">TBD</param>
 public ForceDisassociateExplicitly(Address address, DisassociateInfo reason)
 {
     Reason  = reason;
     Address = address;
 }
Example #21
0
 /// <summary>
 /// TBD
 /// </summary>
 /// <param name="info">TBD</param>
 public Disassociated(DisassociateInfo info)
 {
     Info = info;
 }