Exemplo n.º 1
0
 /// <summary>
 /// Create the environment singleton of the specified type.
 /// </summary>
 /// <typeparam name="T">Environment instance type.</typeparam>
 /// <returns>Environment Instance handle.</returns>
 protected static ZConfigEnv Initialize <T>() where T : ZConfigEnv
 {
     if (!Monitor.TryEnter(__envLock))
     {
         throw new ConfigurationException("Environment Lock not acquired or Lock held by another thread.");
     }
     if (__env == null)
     {
         __env = Activator.CreateInstance <T>();
     }
     return(__env);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Shutdown the environment.
 /// </summary>
 public static void Shutdown()
 {
     Monitor.Enter(__envLock);
     try
     {
         if (__env != null)
         {
             __env.Dispoase();
         }
     }
     catch (Exception ex)
     {
         LogUtils.Error("Error while disposing environment...");
         LogUtils.Error(ex);
     }
     finally
     {
         Monitor.Exit(__envLock);
         __env = null;
     }
 }