Beispiel #1
0
        public static bool Init()
        {
            bool result;

            try
            {
                ConsortiaMgr.m_lock = new ReaderWriterLock();
                ConsortiaMgr._ally  = new Dictionary <string, int>();
                if (!ConsortiaMgr.Load(ConsortiaMgr._ally))
                {
                    result = false;
                }
                else
                {
                    ConsortiaMgr._consortia = new Dictionary <int, ConsortiaInfo>();
                    if (!ConsortiaMgr.LoadConsortia(ConsortiaMgr._consortia))
                    {
                        result = false;
                    }
                    else
                    {
                        result = true;
                    }
                }
            }
            catch (Exception e)
            {
                //if (ConsortiaMgr.log.IsErrorEnabled)
                {
                    ConsortiaMgr.log.Error("ConsortiaMgr", e);
                }
                result = false;
            }
            return(result);
        }
Beispiel #2
0
 public static bool ReLoad()
 {
     try
     {
         Dictionary <string, int>        ally      = new Dictionary <string, int>();
         Dictionary <int, ConsortiaInfo> consortia = new Dictionary <int, ConsortiaInfo>();
         if (ConsortiaMgr.Load(ally) && ConsortiaMgr.LoadConsortia(consortia))
         {
             ConsortiaMgr.m_lock.AcquireWriterLock(15000);
             try
             {
                 ConsortiaMgr._ally      = ally;
                 ConsortiaMgr._consortia = consortia;
                 return(true);
             }
             catch
             {
             }
             finally
             {
                 ConsortiaMgr.m_lock.ReleaseWriterLock();
             }
         }
     }
     catch (Exception exception)
     {
         if (ConsortiaMgr.log.IsErrorEnabled)
         {
             ConsortiaMgr.log.Error("ConsortiaMgr", exception);
         }
     }
     return(false);
 }
Beispiel #3
0
        public static bool ReLoad()
        {
            bool result;

            try
            {
                Dictionary <string, int>        tempAlly      = new Dictionary <string, int>();
                Dictionary <int, ConsortiaInfo> tempConsortia = new Dictionary <int, ConsortiaInfo>();
                if (ConsortiaMgr.Load(tempAlly) && ConsortiaMgr.LoadConsortia(tempConsortia))
                {
                    ConsortiaMgr.m_lock.AcquireWriterLock(-1);
                    try
                    {
                        ConsortiaMgr._ally      = tempAlly;
                        ConsortiaMgr._consortia = tempConsortia;
                        result = true;
                        return(result);
                    }
                    catch
                    {
                    }
                    finally
                    {
                        ConsortiaMgr.m_lock.ReleaseWriterLock();
                    }
                }
            }
            catch (Exception e)
            {
                //if (ConsortiaMgr.log.IsErrorEnabled)
                {
                    ConsortiaMgr.log.Error("ConsortiaMgr", e);
                }
            }
            result = false;
            return(result);
        }