protected void str144_Receive(object sender, TcpIpEventArgs e) { if (scApp.getEQObjCacheManager().getLine().ServerPreStop) { return; } int threadID = System.Threading.Thread.CurrentThread.ManagedThreadId; Stopwatch sw = scApp.StopwatchPool.GetObject(); string lockTraceInfo = string.Format("VH ID:{0},Pack ID:{1},Seq Num:{2},ThreadID:{3}," , eqpt.VEHICLE_ID , e.iPacketID , e.iSeqNum.ToString() , threadID.ToString()); try { sw.Start(); LogManager.GetLogger("LockInfo").Debug(string.Concat(lockTraceInfo, "Wait Lock In")); //TODO Wait Lock In SCUtility.LockWithTimeout(str144_lockObj, SCAppConstants.LOCK_TIMEOUT_MS, str144_ReceiveProcess, sender, e); //Lock Out } catch (Exception ex) { LogManager.GetLogger("LockInfo").Error(string.Concat(lockTraceInfo, "Lock Exception")); logger.Error(ex, "(str144_Receive) Exception"); } finally { long ElapsedMilliseconds = sw.ElapsedMilliseconds; LogManager.GetLogger("LockInfo").Debug(string.Concat(lockTraceInfo, "Lock Out. ElapsedMilliseconds:", ElapsedMilliseconds.ToString())); scApp.StopwatchPool.PutObject(sw); } }
public void insertMCSReport(AMCSREPORTQUEUE mcs_queue) { //lock (mcs_report_lock_obj) //{ SCUtility.LockWithTimeout(mcs_report_lock_obj, SCAppConstants.LOCK_TIMEOUT_MS, () => { //DBConnection_EF con = DBConnection_EF.GetContext(); //using (DBConnection_EF con = new DBConnection_EF()) using (DBConnection_EF con = DBConnection_EF.GetUContext()) { mcsReportQueueDao.add(con, mcs_queue); } }); //} }