GPSd4Java
GPSd4Java copied to clipboard
Sockets Seems not to Close
Hi,I am using gpsd4java version 1.10. I have the following probem. It seems the sockets to the gpsd are not close when i call the stop() in the endpoint. My procedure is the following. If i don't get Gps data for a period of time i stop the endpoint and recreate it. epoint.removeListener(objectListener); epoint.stop(); epoint=null; epoint = new GPSdEndpoint(host, port, new ResultParser()); AddGpsdListeners(); epoint.start(); epoint.version(); epoint.watch(true, true); epoint.poll();
But wathing the sockets in the unix machine where my java app is running using lsof -i -P |grep ProcessId i see that almost each time the code recreates the end point a socket is left open. Is this a knowh bug. How i can overcome it. Some logs 07/May/2019 15:30:48- SocketThread: Problem encountered while reading/parsing/handling line, attempting restart 07/May/2019 15:30:48- SocketThread: Disconnected from GPS socket, retrying connection 07/May/2019 15:30:48- ResultParser: activated: 2019-05-07T12:30:47.866Z 07/May/2019 15:30:48- ResultParser: Date: Tuesday, May 7, 2019 3:30:47 PM EEST 07/May/2019 15:30:48- SocketThread: Connected to GPS socket 07/May/2019 15:30:50- SocketThread: Connecting to GPSD socket 07/May/2019 15:30:53- ResultParser: activated: 2019-05-07T12:30:52.869Z 07/May/2019 15:30:53- ResultParser: Date: Tuesday, May 7, 2019 3:30:52 PM EEST 07/May/2019 15:30:53- SocketThread: Connected to GPS socket
It seems that when the stop occurs at some specific time there is a retry in the SocketThread based on retryConnection timeout and then the start() comes again so one socket stays on.
Thanks in advance.