예제 #1
0
        protected void ScanConsortiaProc(object sender)
        {
            try
            {
                int startTick = Environment.TickCount;
                if (log.IsInfoEnabled)
                {
                    log.Info("Saving Record...");
                    log.Debug("Save ThreadId=" + Thread.CurrentThread.ManagedThreadId);
                }

                ThreadPriority oldprio = Thread.CurrentThread.Priority;
                Thread.CurrentThread.Priority = ThreadPriority.Lowest;

                string noticeID = "";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    db.ScanConsortia(ref noticeID);
                }
                string[] noticeIDs = noticeID.Split(',');

                foreach (string s in noticeIDs)
                {
                    if (string.IsNullOrEmpty(s))
                        continue;

                    GSPacketIn pkg = new GSPacketIn((byte)ePackageType.CONSORTIA_RESPONSE);
                    pkg.WriteByte(2);
                    pkg.WriteInt(int.Parse(s));
                    SendToALL(pkg);
                }

                Thread.CurrentThread.Priority = oldprio;

                startTick = Environment.TickCount - startTick;
                if (log.IsInfoEnabled)
                {
                    log.Info("Scan Consortia complete!");
                }
                if (startTick > 2 * 60 * 1000)
                {
                    log.WarnFormat("Scan all Consortia in {0} ms", startTick);
                }
            }
            catch (Exception e1)
            {
                if (log.IsErrorEnabled)
                    log.Error("ScanConsortiaProc", e1);
            }
        }