StrataFrame Forum

calling ThreadManager.StopAllExecutingThreads() when opening new form

http://forum.strataframe.net/Topic29901.aspx

By Marcel Heitlager - 4/20/2011

When my main mdi form opens I use the threadmanager to asynchronously retrieve some status information from the database to display on the form.
If the task in the main form isn't completed and I tell the threadmanager in the main form form to StopAllExecutingThreads(), I can't  make any remote database calls through es in the child form. The child form also has a threadmanager, but synchronous calls don't work either.

In the main form I call in the load event:
        Me.AESPPMMainThreadManager.AddProcess(AddressOf WebSiteDataModificationsReporter.GetEnrollmentStatus, "tdEnrollmentStatus")
        Me.AESPPMMainThreadManager.AddProcess(AddressOf WebSiteDataModificationsReporter.GetOnePayTransactionUpdates, "tdOnePayTransactions")

then in the click event of the button that opens the child form:
  
 Private Sub tsbDataManagement_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsbDataManagement.Click
        If Me.CheckPermission("Export Data") Or Me.CheckPermission("Import Data") Then
            Me.AESPPMMainThreadManager.StopAllExecutingThreads()
            Me.LoadForm(GetType(AESPPM.Main))
        End If
   End Sub

Then in the load event of the child form:

            Me.ThreadManager1.AddProcess(AddressOf WebSiteDataModificationsReporter.GetEnrollmentStatus, "tdEnrollmentStatus")
            Me.ThreadManager1.AddProcess(AddressOf WebSiteDataModificationsReporter.GetOnePayTransactionUpdates, "tdOnePayTransactions")

Basically it's calling the same methods again, retrieving the same data (checking to see if it has updated).
Once the call in the parent form has aborted, however,  the child form can't access the internet at all whether through sync or async calls.

What might I be missing?

Thanks,

Marcel
By Marcel Heitlager - 4/22/2011

In other words.  How can you cancel an es call to retrieve data, so it will be safe to cancel the threadmanager thread it is running on?

Thanks,

Marcel
By Marcel Heitlager - 5/5/2011

No answer, or dumb question?
By Greg McGuffey - 5/5/2011

Not a dumb question, just a perplexing one (for me anyway). Blink

Could you post a sample that reproduces the issue?  That would speed things up a lot.
By Marcel Heitlager - 5/5/2011

I'll try to create a simple one asap.

Thanks for the response.

Marcel
By Marcel Heitlager - 5/6/2011

I guess a simple app is a little more involving than I thought.

Let me try rephrasing the question again. First, this question is based on the fact that a customer might have a slow connection (satellite).

If you use ES to retrieve data and you wrap that request in a threadmanager thread, what happens to that request if you stop all the threads and ES hasn't finished processing that request yet? What is it supposed to do (in theory)?  Silently Fail? Has this been tested?

My problem is, I'm seeing it lock up all future ES requests, including those not wrapped in a threadmanager thread. 

I can probably figure out what I'm doing wrong if I know what is supposed to happen.

Thanks,

Marcel