Apache.NMS.ActiveMQ.Transactions.RecoveryFileLogger.TryOpenRecoveryInfoFile C# (CSharp) Method

TryOpenRecoveryInfoFile() private method

private TryOpenRecoveryInfoFile ( ) : RecoveryInformation
return RecoveryInformation
        private RecoveryInformation TryOpenRecoveryInfoFile()
        {
            RecoveryInformation result = null;

            Tracer.Debug("Checking for Recoverable Transactions filename: " + Filename);

            lock (syncRoot)
            {
                try
                {
                    if (!File.Exists(Filename))
                    {
                        return null;
                    }

                    using(FileStream recoveryLog = new FileStream(Filename, FileMode.Open, FileAccess.Read))
                    {
                        Tracer.Debug("Found Recovery Log File: " + Filename);
                        IFormatter formatter = new BinaryFormatter();
                        result = formatter.Deserialize(recoveryLog) as RecoveryInformation;
                    }
                }
                catch(Exception ex)
                {
                    Tracer.InfoFormat("Error while opening Recovery file {0} error message: {1}", Filename, ex.Message);
                    // Nothing to restore.
                    return null;
                }
            }

            return result;
        }