improving server shutdown to try to get rid of the 'will not shutdown' problem.
This commit is contained in:
@@ -41,6 +41,20 @@ public class LocationFinder implements LocationListener
|
||||
mLocationListener = this;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
// Cancel location updates
|
||||
mLocationManager.removeUpdates(this);
|
||||
|
||||
// cancel the timeout timer
|
||||
if (mTimeoutTimer != null) {
|
||||
mTimeoutTimer.cancel();
|
||||
mTimeoutTimer.purge();
|
||||
mTimeoutTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Location getLastLocation() {
|
||||
return mLastLocation;
|
||||
}
|
||||
@@ -105,5 +119,6 @@ public class LocationFinder implements LocationListener
|
||||
public void onProviderDisabled(String s) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
|
||||
private HandlerThread thread;
|
||||
private WakeLock mWakeLock = null;
|
||||
private LocationFinder mLocationFinder;
|
||||
private LocationFinder mLocationFinder = null;
|
||||
public SdDataSource mSdDataSource;
|
||||
public SdData mSdData = null;
|
||||
public String mSdDataSourceName = "undefined"; // The name of the data soruce specified in the preferences.
|
||||
@@ -376,18 +376,11 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
// Stop the Cancel Alarm Latch timer
|
||||
stopLatchTimer();
|
||||
|
||||
// Stop the status timer
|
||||
/*if (dataLogTimer != null) {
|
||||
Log.v(TAG, "stop(): cancelling Data logger timer");
|
||||
mUtil.writeToSysLogFile("onDestroy() - cancelling data log timer");
|
||||
dataLogTimer.cancel();
|
||||
dataLogTimer.purge();
|
||||
dataLogTimer = null;
|
||||
}
|
||||
*/
|
||||
|
||||
// Stop the log Manager
|
||||
//mLm.close();
|
||||
// Stop the location finder.
|
||||
if (mLocationFinder != null) {
|
||||
mLocationFinder.destroy();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
@@ -414,6 +407,8 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
mUtil.writeToSysLogFile("SdServer.onDestroy() -error " + e.toString());
|
||||
}
|
||||
|
||||
super.onDestroy();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -999,13 +994,21 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
Log.i(TAG, "SdServer.stopWebServer()");
|
||||
if (webServer != null) {
|
||||
webServer.stop();
|
||||
if (webServer.isAlive()) {
|
||||
Log.w(TAG, "stopWebServer() - server still alive???");
|
||||
if (webServer == null) {
|
||||
mUtil.writeToSysLogFile("stopWebServer() - server null - server died ok");
|
||||
Log.v(TAG, "stopWebServer() - server null - server died ok");
|
||||
} else {
|
||||
Log.v(TAG, "stopWebServer() - server died ok");
|
||||
if (webServer.isAlive()) {
|
||||
Log.w(TAG, "stopWebServer() - server still alive???");
|
||||
} else {
|
||||
mUtil.writeToSysLogFile("stopWebServer() - server died ok");
|
||||
Log.v(TAG, "stopWebServer() - server died ok");
|
||||
}
|
||||
}
|
||||
webServer = null;
|
||||
//webServer = null;
|
||||
}
|
||||
mUtil.writeToSysLogFile("unregisterig network broadcast receiver");
|
||||
Log.v(TAG, "unregistering network broadcast receiver");
|
||||
getApplicationContext().unregisterReceiver(mNetworkBroadcastReceiver);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user