In my project (with jServer) i have a websocket class that in the connect method it calls a resumable sub from a module.
When the method is first called I get that is running on the websocket class thread:
Current Thread: pool-1-thread-1
But after the Sleep kicks in the resumable sub is executed on the main thread:
Current Thread: main
If I move the method to the websocket class then the resumable sub runs in the websocket thread.
Is this by design ? Can't the resumable sub from a module run in the caller thread ?
B4X:
Public Sub InitializeWebSocketHeartBeat(WebSocketObject As WebSocket)
Do While WebSocketObject.Open
Dim t As JavaObject
Log("Current Thread: " & t.InitializeStatic("java.lang.Thread").RunMethodJO("currentThread", Null).RunMethod("getName", Null))
Sleep(3000)
If BrowserIsReachable(WebSocketObject) Then Sleep(57000)
Loop
End Sub
When the method is first called I get that is running on the websocket class thread:
Current Thread: pool-1-thread-1
But after the Sleep kicks in the resumable sub is executed on the main thread:
Current Thread: main
If I move the method to the websocket class then the resumable sub runs in the websocket thread.
Is this by design ? Can't the resumable sub from a module run in the caller thread ?