First of all, I can’t understand your words about streaming:
I need to do thread programming in the above program to avoid memory exception.
, TPL, . Thread, . , C# 4.0, TPL . - ( ):
List<Task> tasks = new List<Task>();
while(!parser.EndOfData)
{
tasks.Add(Task.Run(() => WriteTodb(tablename, set)));
}
Task.WaitAll(tasks.ToArray());
TPL- TaskScheduler , ThreadPool , .
, , HBase Microsoft, async :
public async Task StoreCellsAsync(string table, CellSet cells)
{
}
, TPL :
List<Task> tasks = new List<Task>();
while(!parser.EndOfData)
{
tasks.Add(WriteTodb(tablename, set)));
}
await Task.WhenAll(tasks.ToArray());
public async Task WriteTodb(string table,CellSet set)
{
await hbase.StoreCellsAsync(TableName, set);
}
- TPL, :