Fix pool registered after interruption

This commit is contained in:
Mygod
2018-03-23 11:05:13 -07:00
committed by GitHub
parent b698ec3ee0
commit c26377ae47

View File

@@ -71,12 +71,12 @@ class IpNeighbourMonitor private constructor() : Runnable {
} }
} }
monitor.waitFor() monitor.waitFor()
if (monitor.exitValue() == 0) return@thread
Log.w(TAG, "Failed to set up monitor, switching to polling")
val pool = Executors.newScheduledThreadPool(1)
pool.scheduleAtFixedRate(this, 1, 1, TimeUnit.SECONDS)
this.pool = pool
} catch (ignore: InterruptedIOException) { } } catch (ignore: InterruptedIOException) { }
if (monitor.exitValue() == 0) return@thread
Log.w(TAG, "Failed to set up monitor, switching to polling")
val pool = Executors.newScheduledThreadPool(1)
pool.scheduleAtFixedRate(this, 1, 1, TimeUnit.SECONDS)
this.pool = pool
} }
} }