补齐连接反复断开和缓存失败重试边界
This commit is contained in:
@@ -386,6 +386,13 @@ public class RemoteService {
|
||||
} finally {
|
||||
monitorSocket = null;
|
||||
monitoring.set(false);
|
||||
// A connection may flap while the previous monitor is still exiting.
|
||||
if (!stopping && isDead()) {
|
||||
try { networkGroup.next().schedule(this::startMonitor, 5, TimeUnit.SECONDS); }
|
||||
catch (java.util.concurrent.RejectedExecutionException e) {
|
||||
if (!stopping) log.warn("安排节点监听重试失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@ class ImageFileCacheTest {
|
||||
assertThrows(Exception.class, () -> ImageFileCache.get(cache, "1", () -> root.resolve("missing.gif").toUri().toString()));
|
||||
assertNull(ImageFileCache.find(cache, "1"));
|
||||
try (var files = Files.list(cache)) { assertEquals(0, files.count()); }
|
||||
Path source = root.resolve("retry.gif");
|
||||
Files.writeString(source, "GIF89a retry");
|
||||
assertNotNull(ImageFileCache.get(cache, "1", () -> source.toUri().toString()));
|
||||
}
|
||||
|
||||
@Test void concurrentCallersShareTheSameOperation() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user