mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
80b57618b7
--HG-- rename : mobile/android/base/sync/GlobalConstants.java.in => mobile/android/base/background/common/GlobalConstants.java.in rename : mobile/android/base/sync/Logger.java => mobile/android/base/background/common/log/Logger.java rename : mobile/android/base/sync/log/writers/AndroidLevelCachingLogWriter.java => mobile/android/base/background/common/log/writers/AndroidLevelCachingLogWriter.java rename : mobile/android/base/sync/log/writers/AndroidLogWriter.java => mobile/android/base/background/common/log/writers/AndroidLogWriter.java rename : mobile/android/base/sync/log/writers/LevelFilteringLogWriter.java => mobile/android/base/background/common/log/writers/LevelFilteringLogWriter.java rename : mobile/android/base/sync/log/writers/LogWriter.java => mobile/android/base/background/common/log/writers/LogWriter.java rename : mobile/android/base/sync/log/writers/PrintLogWriter.java => mobile/android/base/background/common/log/writers/PrintLogWriter.java rename : mobile/android/base/sync/log/writers/SimpleTagLogWriter.java => mobile/android/base/background/common/log/writers/SimpleTagLogWriter.java rename : mobile/android/base/sync/log/writers/StringLogWriter.java => mobile/android/base/background/common/log/writers/StringLogWriter.java rename : mobile/android/base/sync/log/writers/TagLogWriter.java => mobile/android/base/background/common/log/writers/TagLogWriter.java rename : mobile/android/base/sync/log/writers/ThreadLocalTagLogWriter.java => mobile/android/base/background/common/log/writers/ThreadLocalTagLogWriter.java
45 lines
1.2 KiB
Java
45 lines
1.2 KiB
Java
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.gecko.sync.net;
|
|
|
|
import org.mozilla.gecko.background.common.log.Logger;
|
|
|
|
/**
|
|
* Every <code>REAP_INTERVAL</code> milliseconds, wake up
|
|
* and expire any connections that need cleaning up.
|
|
*
|
|
* When we're told to shut down, take the connection manager
|
|
* with us.
|
|
*/
|
|
public class ConnectionMonitorThread extends Thread {
|
|
private static final long REAP_INTERVAL = 5000; // 5 seconds.
|
|
private static final String LOG_TAG = "ConnectionMonitorThread";
|
|
|
|
private volatile boolean stopping;
|
|
|
|
@Override
|
|
public void run() {
|
|
try {
|
|
while (!stopping) {
|
|
synchronized (this) {
|
|
wait(REAP_INTERVAL);
|
|
BaseResource.closeExpiredConnections();
|
|
}
|
|
}
|
|
} catch (InterruptedException e) {
|
|
Logger.trace(LOG_TAG, "Interrupted.");
|
|
}
|
|
BaseResource.shutdownConnectionManager();
|
|
}
|
|
|
|
public void shutdown() {
|
|
Logger.debug(LOG_TAG, "ConnectionMonitorThread told to shut down.");
|
|
stopping = true;
|
|
synchronized (this) {
|
|
notifyAll();
|
|
}
|
|
}
|
|
}
|