This is a B4J Server app handling lots of Websocket connections.
I am trying to close redundant instances of the WebsocketHandler class.
I maintain a ThreadsafeMap in the Main Activity with an entry in the Map for each Instance of the WebsocketHandler Class. This shows that after a day or so I have maybe five times more instances than I have remote devices. I guess this is devices connecting, then disconnecting, then reconnecting using a new WebsocketHandler instance.
I can see which ones are redundant as the remote device has stopped talking to the Instance. I can also which Instances have a duplicated Session ID. The question is: How do close the redundant instance? I can close the websocket connection (ws.close) and I have tried setting the Instance to Null from the Main Activity but the instance remains active with timers running etc and the number of instances keeps accumulating.
I'm looking for something like "Me.Close" to call from within the Class.
I am trying to close redundant instances of the WebsocketHandler class.
I maintain a ThreadsafeMap in the Main Activity with an entry in the Map for each Instance of the WebsocketHandler Class. This shows that after a day or so I have maybe five times more instances than I have remote devices. I guess this is devices connecting, then disconnecting, then reconnecting using a new WebsocketHandler instance.
I can see which ones are redundant as the remote device has stopped talking to the Instance. I can also which Instances have a duplicated Session ID. The question is: How do close the redundant instance? I can close the websocket connection (ws.close) and I have tried setting the Instance to Null from the Main Activity but the instance remains active with timers running etc and the number of instances keeps accumulating.
I'm looking for something like "Me.Close" to call from within the Class.