Apache.NMS.ActiveMQ.Transactions.RecoveryFileLogger.Initialize C# (CSharp) Метод

Initialize() публичный Метод

public Initialize ( string resourceManagerId ) : void
resourceManagerId string
Результат void
        public void Initialize(string resourceManagerId)
        {
            this.resourceManagerId = resourceManagerId;

            // Test if the location configured is valid.
            if(!Directory.Exists(Location))
            {
                if(AutoCreateLocation)
                {
                    try
                    {
                        Directory.CreateDirectory(Location);
                    }
                    catch(Exception ex)
                    {
                        Tracer.Error("Failed to create log directory: " + ex.Message);
                        throw NMSExceptionSupport.Create(ex);
                    }
                }
                else
                {
                    throw new NMSException("Configured Recovery Log Location does not exist: " + location);
                }
            }
        }

Usage Example

Пример #1
0
        public void TestInitWithNoLocationSet()
        {
            RecoveryFileLogger logger = new RecoveryFileLogger();

            logger.Initialize(rmId.ToString());

            Assert.AreEqual(Directory.GetCurrentDirectory(), logger.Location);
        }
All Usage Examples Of Apache.NMS.ActiveMQ.Transactions.RecoveryFileLogger::Initialize