C#??????У???????????÷????
???????????? ???????[ 2016/3/3 11:25:53 ] ????????.NET ??????????? ???
??????3????????÷????????????????????????????????????????????????????????????Χ???????????????????÷????£?
public class CSpiderCtrl
{
//?????????????????????
static Semaphore semaphore;
public static void Run()
{
//1. ???? SuperLCBB????????
var oClient = new ServiceReference_SuperLCBB.SOAServiceClient();
//2.??????????new??????????255?????????????????????ж???????????????????????????????????
semaphore = new Semaphore(250?? 255);
CLogService.Instance.Debug("??????????...");
_TestBedGo(oClient);
}
//??ж????????
private static void _TestBedGo(ServiceReference_SuperLCBB.SOAServiceClient oClient)
{
List<string> lstExceptPDUs = new List<string>(){
"SUPERLABEXP"
};
var oTestBedRes = oClient.GetTestBedExceptSomePDU(lstExceptPDUs.ToArray()?? true);
if (CKVRes.ERRCODE_SUCCESS != oTestBedRes.ErrCode)
{
CLogService.Instance.Error("xxx");
return;
}
var lstTestBed = oTestBedRes.ToDocumentsEx();
System.Threading.Tasks.Parallel.ForEach(lstTestBed?? (oTestBed) =>
{
//??ζ?255??????????255???????????????????????????
semaphore.WaitOne();
//CLogService.Instance.Info("?????????????" + oTestBed[TBLTestBed.PROP_NAME]);
//Thread.Sleep(2000);
var strTestBedName = oTestBed[TBLTestBed.PROP_NAME] as string;
var strSuperDevIP = oTestBed[TBLTestBed.PROP_SUPERDEVIP] as string;
var strTestBedGID = oTestBed[TBLTestBed.PROP_GID] as string;
var strPdu = oTestBed[TBLTestBed.PROP_PDUGID] as string;
Thread.Sleep(new Random().Next(1000?? 5000));
var oGetRootDevicesByTestBedGIDRes = oClient.GetRootDevicesByTestBedGID(strTestBedGID);
CLogService.Instance.Debug(strPdu + "——?????Name??" + strTestBedName + "???");
Stopwatch sp = new Stopwatch();
sp.Start();
if (oGetRootDevicesByTestBedGIDRes.ErrCode != CKVRes.ERRCODE_SUCCESS || oGetRootDevicesByTestBedGIDRes.Documents.Count < 2)
{
CLogService.Instance.Debug("shit -- 3??????в????Name??" + strTestBedName + "2?????0");
//?????????????????return ????????????????????????????????
semaphore.Release();
return;
}
var strXML = oGetRootDevicesByTestBedGIDRes.Documents[0];
var strExeName = oGetRootDevicesByTestBedGIDRes.Documents[1];
//var strExeName = "RateSpider";
var oSuperDevClient = new SuperDevClient(CSuperDev.ENDPOINT?? string.Format(CSuperDev.SuperDevURL?? strSuperDevIP));
try
{
oSuperDevClient.IsOK();
}
catch (Exception)
{
CLogService.Instance.Error("?????Name??" + strTestBedName + "??????????");
semaphore.Release();
return;
}
//2.3.1.????SuperDev.Server(SuperDevIP)??????Run(XML??Exename)
var oRunExeRes = new CKVRes();
try
{
oRunExeRes = oSuperDevClient.RunExeEx(strExeName?? false?? new string[] { strXML });
}
catch
{
//CLogService.Instance.Debug("?????Name??" + strTestBedName + "??:" + ex.Message);
}
sp.Stop();
CLogService.Instance.Debug(strPdu + "——?????Name??" + strTestBedName + "??????" + sp.Elapsed);
//???????????????????
semaphore.Release();
});
}
}
??????????Semaphore??????????????????????????????趨??System.Threading.Tasks.Parallel.ForEach??????????????lstTestBed.Length??????????????飬????????
????foreach(var oTestbed in lstTestBed)
????{
????Thread oThread=new Thread(new ThreadStart({ ...}));
????}
??????4?? ????????滹????????????SpinWait?????????????????????????????????????????????У??????????????????????????????÷???
????public static void SpinUntil(Func<bool> condition);
????public static bool SpinUntil(Func<bool> condition?? int millisecondsTimeout);
????public static bool SpinUntil(Func<bool> condition?? TimeSpan timeout);
????????????????????????????????????????????????????漲??????????з????????????????????????
SpinWait.SpinUntil(() =>
{
bIsworking = m_oClient.isworking(new isworking()).result;
return bIsworking == false;
}?? 600000);
//???????10?????????????????
if (bIsworking)
{
oRes.ErrCode = "false???????????????10????????????????";
return oRes;
}
??????????ù????????÷??????????????????Щ???л??漰??????????????????????????Щ??????????????ī?????????????????ú?????????Щ???????????????????????????????????????ó?????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
???????C#?е?StringC# Socket???????????????????C#?????????????????????????C#???????C#????????????Log4net??????δ????C#?????????????C#?????????????????C#???????????????C#????????????????C#7 ?е?Tuple??????C#??TypeScript - GeneratorC# ?????????細??????????C#?е???н???C#??MySQL?????????μ??Ч?????д??C#????C++??dll???C#??VS2010????е??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????