From 9a5f31b3c2a6a067a0ae0b47d9948407642ee269 Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sat, 5 Oct 2024 20:20:09 -0700 Subject: [PATCH] Clarify reconnect behavior. --- src/main/java/org/cojen/dirmi/Session.java | 3 ++- src/test/java/org/cojen/dirmi/RestorableTest.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cojen/dirmi/Session.java b/src/main/java/org/cojen/dirmi/Session.java index fadc88b..9196524 100644 --- a/src/main/java/org/cojen/dirmi/Session.java +++ b/src/main/java/org/cojen/dirmi/Session.java @@ -158,7 +158,8 @@ void connected(SocketAddress localAddr, SocketAddress remoteAddr, void addStateListener(BiPredicate, Throwable> listener); /** - * Closes all connections and initiates a reconnect. + * Closes all connections and initiates a reconnect. Operation has no effect if the session + * is closed. */ void reconnect(); diff --git a/src/test/java/org/cojen/dirmi/RestorableTest.java b/src/test/java/org/cojen/dirmi/RestorableTest.java index 4794eaf..03edf4a 100644 --- a/src/test/java/org/cojen/dirmi/RestorableTest.java +++ b/src/test/java/org/cojen/dirmi/RestorableTest.java @@ -210,6 +210,16 @@ public boolean test(Session session, Throwable ex) { } assertTrue(listener.reconnected); + + mSession.close(); + + mSession.reconnect(); + + try { + r1x.echo("world"); + fail(); + } catch (ClosedException e) { + } } @Test