B4J Question Any way to stop BackgroundWorker from Main?

tchart

Well-Known Member
Licensed User
Longtime User
I have a B4J server app that runs as a Windows service. I have defined a method in my Main to close the database connection when the service is stopped (i.e. the service wrapper calls the method).

Last night I was doing some testing and noticed one of my background workers happend to fire when the service was stopping (the error was related to the database being closed).

So, as per the title, is the a way to stop a BackgroundWorker from Main?

Or is perhaps stopping the webserver better (although I dont see a stop method).
 

tchart

Well-Known Member
Licensed User
Longtime User
Oh I see there is this to stop the server;

B4X:
Dim jo As JavaObject = server
jo.GetFieldJO("server").RunMethod("stop", null)
 
Upvote 0
Top