From 17b883e101bc81657d726cd2a218d74aadb77cce Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 21 Nov 2023 23:36:50 +0000 Subject: [PATCH] feat: throw exception when trying to attach on released channel --- .../io/ably/lib/realtime/AblyRealtime.java | 1 + .../io/ably/lib/realtime/ChannelBase.java | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java b/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java index ffb33d426..34098ea0b 100644 --- a/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java +++ b/lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java @@ -206,6 +206,7 @@ public Channel get(final String channelName, final ChannelOptions channelOptions public void release(String channelName) { Channel channel = map.remove(channelName); if(channel != null) { + channel.markAsReleased(); try { channel.detach(); } catch (AblyException e) { diff --git a/lib/src/main/java/io/ably/lib/realtime/ChannelBase.java b/lib/src/main/java/io/ably/lib/realtime/ChannelBase.java index 1da00e9ba..e7728c3cc 100644 --- a/lib/src/main/java/io/ably/lib/realtime/ChannelBase.java +++ b/lib/src/main/java/io/ably/lib/realtime/ChannelBase.java @@ -83,6 +83,13 @@ public abstract class ChannelBase extends EventEmitter