예제 #1
0
 /// <summary>
 /// 重置引擎连接
 /// </summary>
 /// <param name="connectionString"></param>
 public static void ResetEngine(string connectionString)
 {
     lock (MonoConnectionLockObject)
     {
         ConnectionString = connectionString;
         MonoConnection   = null;
     }
 }
 /// <summary>
 /// 设置引擎连接
 /// </summary>
 /// <param name="connection"></param>
 private static void SetEngin(string connection)
 {
     lock (MonoConnectionLockObject)
     {
         if (MonoConnection == null || MonoConnection.Engine == null)
         {
             OThinker.H3.Connection c = new OThinker.H3.Connection();
             string connectionString  = System.Configuration.ConfigurationManager.AppSettings["BPMEngine"];
             try
             {
                 OThinker.Clusterware.ConnectionResult result = c.Open(connection);
                 if (result != OThinker.Clusterware.ConnectionResult.Success)
                 {
                     throw new Exception("引擎服务连接错误->" + result.ToString());
                 }
             }
             catch (Exception ex)
             {
                 try
                 {
                     OThinker.Clusterware.ConnectionResult result = c.Open(connectionString);
                     if (result != OThinker.Clusterware.ConnectionResult.Success)
                     {
                         throw new Exception("引擎服务连接错误->" + result.ToString());
                     }
                 }
                 catch (Exception e)
                 {
                     throw e;
                 }
             }
             MonoConnection = c;
         }
     }
     _engine = MonoConnection.Engine;
 }