namespace AsiaINFO.SMS.APPCMPP2.MyThread.CMPPThread
|
{
|
using AsiaINFO.SMS.APPCMPP2;
|
using AsiaINFO.SMS.APPCMPP2.MyThread;
|
using AsiaINFO.SMS.BusinessFactory;
|
using AsiaINFO.SMS.CMPP2;
|
using AsiaINFO.SMS.Entity;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Threading;
|
|
public class SubmitOKThread : ThreadBase
|
{
|
private Queue<SubmitInfo> _submitOKQueue;
|
private Queue<SubmitInfo> _submitQueue;
|
|
public SubmitOKThread(SyncEvents syncEvents, Queue<SubmitInfo> submitQueue, Queue<SubmitInfo> submitOKQueue) : base(syncEvents)
|
{
|
if ((submitQueue == null) || (submitOKQueue == null))
|
{
|
throw new Exception("SubmitOKThread参数不能为空!");
|
}
|
this._submitQueue = submitQueue;
|
this._submitOKQueue = submitOKQueue;
|
}
|
|
private void DealData(SubmitInfo submit)
|
{
|
try
|
{
|
MTBusiness.UpdateMTInfo(submit);
|
MTBusiness.DeleteMTWait(submit.MTWait, ShareData.CurrentISMG);
|
}
|
catch (Exception exception)
|
{
|
this._submitData = submit;
|
base.OnMsg("[记录SUBMIT数据错误] " + exception.Message, MsgLevel.Err);
|
}
|
}
|
|
protected override void Run()
|
{
|
SubmitInfo submit = null;
|
while (WaitHandle.WaitAny(base._syncEvents.EventArray) != 1)
|
{
|
object obj2;
|
Label_0004:
|
Monitor.Enter(obj2 = base._syncSuspendLogLockObject);
|
try
|
{
|
submit = this._submitOKData;
|
if (submit != null)
|
{
|
this.DealData(submit);
|
goto Label_0004;
|
}
|
}
|
finally
|
{
|
Monitor.Exit(obj2);
|
}
|
}
|
base.Stop();
|
}
|
|
public override void Stop()
|
{
|
if ((base._thread != null) && (base._thread.ThreadState == ThreadState.Suspended))
|
{
|
base.Stop();
|
}
|
base._syncEvents.ExitThreadEvent.Set();
|
}
|
|
private SubmitInfo _submitData
|
{
|
get
|
{
|
lock (((ICollection) this._submitQueue).SyncRoot)
|
{
|
if (this._submitQueue.Count > 0)
|
{
|
return this._submitQueue.Dequeue();
|
}
|
}
|
return null;
|
}
|
set
|
{
|
lock (((ICollection) this._submitQueue).SyncRoot)
|
{
|
this._submitQueue.Enqueue(value);
|
}
|
}
|
}
|
|
private SubmitInfo _submitOKData
|
{
|
get
|
{
|
lock (((ICollection) this._submitOKQueue).SyncRoot)
|
{
|
if (this._submitOKQueue.Count > 0)
|
{
|
return this._submitOKQueue.Dequeue();
|
}
|
}
|
return null;
|
}
|
set
|
{
|
lock (((ICollection) this._submitOKQueue).SyncRoot)
|
{
|
this._submitOKQueue.Enqueue(value);
|
}
|
}
|
}
|
}
|
}
|