Skip to content

Commit f3cb37b

Browse files
committed
Remove more unused code: SshConnectionHelper, HttpClientManager.shutdown, NavigationServiceManager.resetMapCache
1 parent 52cb7c6 commit f3cb37b

4 files changed

Lines changed: 6 additions & 130 deletions

File tree

.idea/appInsightsSettings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/ch/fhnw/pepper_realtime/network/HttpClientManager.kt

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package ch.fhnw.pepper_realtime.network
22

3-
import android.os.Looper
43
import android.util.Log
54
import kotlinx.coroutines.CoroutineDispatcher
65
import kotlinx.coroutines.suspendCancellableCoroutine
@@ -10,7 +9,6 @@ import okhttp3.MediaType.Companion.toMediaType
109
import okhttp3.RequestBody.Companion.toRequestBody
1110
import java.io.IOException
1211
import java.util.concurrent.TimeUnit
13-
import java.util.concurrent.atomic.AtomicBoolean
1412
import javax.inject.Inject
1513
import javax.inject.Singleton
1614
import kotlin.coroutines.resume
@@ -48,7 +46,6 @@ class HttpClientManager @Inject constructor() {
4846
private val webSocketClient: OkHttpClient
4947
private val apiClient: OkHttpClient
5048
private val quickApiClient: OkHttpClient
51-
private val shutdownInitiated = AtomicBoolean(false)
5249

5350
init {
5451
Log.i(TAG, "Initializing optimized HTTP client manager")
@@ -178,46 +175,6 @@ class HttpClientManager @Inject constructor() {
178175
)
179176
}
180177

181-
/**
182-
* Cleanup resources - call on app shutdown
183-
*/
184-
fun shutdown() {
185-
if (!shutdownInitiated.compareAndSet(false, true)) {
186-
Log.d(TAG, "Shutdown already in progress - ignoring duplicate request")
187-
return
188-
}
189-
190-
synchronized(HttpClientManager::class.java) {
191-
if (instance == this) {
192-
instance = null
193-
}
194-
}
195-
196-
val task = Runnable { shutdownInternal() }
197-
if (Looper.myLooper() == Looper.getMainLooper()) {
198-
Log.d(TAG, "Shutdown requested on main thread - offloading to background thread")
199-
Thread(task, "http-client-shutdown").start()
200-
} else {
201-
task.run()
202-
}
203-
}
204-
205-
private fun shutdownInternal() {
206-
try {
207-
webSocketClient.dispatcher.executorService.shutdown()
208-
apiClient.dispatcher.executorService.shutdown()
209-
quickApiClient.dispatcher.executorService.shutdown()
210-
211-
webSocketClient.connectionPool.evictAll()
212-
213-
Log.i(TAG, "HTTP client manager shutdown completed")
214-
} catch (e: Exception) {
215-
Log.w(TAG, "Error during HTTP client shutdown", e)
216-
} finally {
217-
Log.i(TAG, "HTTP client manager instance reset for clean restart")
218-
shutdownInitiated.set(false)
219-
}
220-
}
221178
}
222179

223180

app/src/main/java/ch/fhnw/pepper_realtime/network/SshConnectionHelper.kt

Lines changed: 0 additions & 79 deletions
This file was deleted.

app/src/pepper/java/ch/fhnw/pepper_realtime/manager/NavigationServiceManager.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -629,14 +629,6 @@ class NavigationServiceManager(private val movementController: MovementControlle
629629

630630
Log.i(TAG, "NavigationServiceManager shutdown complete")
631631
}
632-
633-
/**
634-
* Aggressively clear map-related caches and force GC to free memory before loading big maps.
635-
*/
636-
fun resetMapCache() {
637-
Log.i(TAG, "Resetting map cache before loading new map")
638-
mapCache.reset()
639-
}
640632
}
641633

642634

0 commit comments

Comments
 (0)