public Run ( Google.Api.Ads.AdWords.Lib.AdWordsUser user, long adGroupId ) : void | ||
user | Google.Api.Ads.AdWords.Lib.AdWordsUser | The AdWords user. |
adGroupId | long | Id of the ad group to which keywords are added. /// |
return | void |
public void Run(AdWordsUser user, long adGroupId)
{
const int NUM_THREADS = 100;
// Increase the maximum number of parallel HTTP connections that .NET
// framework allows. By default, this is set to 2 by the .NET framework.
System.Net.ServicePointManager.DefaultConnectionLimit = NUM_THREADS;
List<Thread> threads = new List<Thread>();
for (int i = 0; i < NUM_THREADS; i++) {
Thread thread = new Thread(new KeywordThread(user, i, adGroupId).Run);
threads.Add(thread);
}
for (int i = 0; i < NUM_THREADS; i++) {
threads[i].Start(i);
}
for (int i = 0; i < NUM_THREADS; i++) {
threads[i].Join();
}
}
/// <summary> /// Main method, to run this code example as a standalone application. /// </summary> /// <param name="args">The command line arguments.</param> public static void Main(string[] args) { HandleRateExceededError codeExample = new HandleRateExceededError(); Console.WriteLine(codeExample.Description); try { long adGroupId = long.Parse("INSERT_ADGROUP_ID_HERE"); codeExample.Run(new AdWordsUser(), adGroupId); } catch (Exception ex) { Console.WriteLine("An exception occurred while running this code example. {0}", ExampleUtilities.FormatException(ex)); } }