BeginAutomaticRecovery() public method

public BeginAutomaticRecovery ( ) : void
return void
Example #1
0
        public void init()
        {
            m_delegate = new Connection(m_factory, false, m_factory.CreateFrameHandler());

            AutorecoveringConnection         self             = this;
            EventHandler <ShutdownEventArgs> recoveryListener = (_, args) =>
            {
                lock (recoveryLockTarget)
                {
                    if (ShouldTriggerConnectionRecovery(args))
                    {
                        try
                        {
                            self.BeginAutomaticRecovery();
                        }
                        catch (Exception e)
                        {
                            // TODO: logging
                            Console.WriteLine("BeginAutomaticRecovery() failed: {0}", e);
                        }
                    }
                }
            };

            lock (m_eventLock)
            {
                ConnectionShutdown += recoveryListener;
                if (!m_recordedShutdownEventHandlers.Contains(recoveryListener))
                {
                    m_recordedShutdownEventHandlers.Add(recoveryListener);
                }
            }
        }
        private void Init(IFrameHandler fh)
        {
            m_delegate = new Connection(m_factory, false,
                                        fh, this.ClientProvidedName);

            AutorecoveringConnection         self             = this;
            EventHandler <ShutdownEventArgs> recoveryListener = (_, args) =>
            {
                lock (recoveryLockTarget)
                {
                    if (ShouldTriggerConnectionRecovery(args))
                    {
                        try
                        {
                            self.BeginAutomaticRecovery();
                        }
                        catch (Exception e)
                        {
                            ESLog.Error("BeginAutomaticRecovery() failed.", e);
                        }
                    }
                }
            };

            lock (m_eventLock)
            {
                ConnectionShutdown += recoveryListener;
                if (!m_recordedShutdownEventHandlers.Contains(recoveryListener))
                {
                    m_recordedShutdownEventHandlers.Add(recoveryListener);
                }
            }
        }
        private void Init(AmqpTcpEndpoint endpoint)
        {
            m_delegate = new Connection(m_factory, false,
                                        m_factory.CreateFrameHandler(endpoint),
                                        this.ClientProvidedName);

            AutorecoveringConnection         self             = this;
            EventHandler <ShutdownEventArgs> recoveryListener = (_, args) =>
            {
                lock (recoveryLockTarget)
                {
                    if (ShouldTriggerConnectionRecovery(args))
                    {
                        try
                        {
                            self.BeginAutomaticRecovery();
                        }
                        catch (Exception e)
                        {
                            // TODO: logging
#if NETFX_CORE
                            System.Diagnostics.Debug.WriteLine(
#else
                            Console.WriteLine(
#endif
                                "BeginAutomaticRecovery() failed: {0}", e);
                        }
                    }
                }
            };

            lock (m_eventLock)
            {
                ConnectionShutdown += recoveryListener;
                if (!m_recordedShutdownEventHandlers.Contains(recoveryListener))
                {
                    m_recordedShutdownEventHandlers.Add(recoveryListener);
                }
            }
        }