Hi guys -
I have three very hefty functions that load data from the DB, but can
run independently of each other. I run them like this:
LoadRecipeGraph();
LoadIngredientGraph();
LoadRatingGraph();
This works great, no errors. Since they all take several seconds
each, I'd like to run them in parallel. So I'm trying this:
Thread recipeLoader = new Thread(LoadRecipeGraph);
Thread ingLoader = new Thread(LoadIngredientGraph);
Thread ratingLoader = new Thread(LoadRatingGraph);
recipeLoader.Start();
ingLoader.Start();
ratingLoader.Start();
recipeLoader.Join();
ingLoader.Join();
ratingLoader.Join();
The first one starts, with no errors. However, when I call Start on
the second one, I immediately get:
"WebThreadScopeInfo: Could not access HttpContext.Current"
on the line:
ISession session = holder.CreateSession(typeof(DB.User));
Each function is pretty much the same, it loads data from a view like this:
ISessionFactoryHolder holder = ActiveRecordMediator.GetSessionFactoryHolder();
ISession session = holder.CreateSession(typeof(DB.User)); <-- Crash here
IDbCommand cmd = session.Connection.CreateCommand();
cmd.CommandType = CommandType.TableDirect;
cmd.CommandText = "SomeDBView";
IDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
//Do a bunch of junk
}
What am I doing wrong? Thanks!!
Mike
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.