File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
client/src/main/java/org/asynchttpclient/netty/channel Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1313 */
1414package org .asynchttpclient .netty .channel ;
1515
16- import java .util .concurrent .atomic .AtomicBoolean ;
17-
1816import io .netty .channel .Channel ;
1917import io .netty .channel .ChannelId ;
2018import io .netty .channel .DefaultChannelId ;
@@ -31,7 +29,9 @@ public class Channels {
3129
3230 private static final AttributeKey <Object > DEFAULT_ATTRIBUTE = AttributeKey .valueOf ("default" );
3331 private static final AttributeKey <ChannelId > CHANNEL_ID_ATTRIBUTE = AttributeKey .valueOf ("channelId" );
34- private static final AttributeKey <AtomicBoolean > INACTIVE_TOKEN_ATTRIBUTE = AttributeKey .valueOf ("inactiveToken" );
32+ private static final AttributeKey <Inactive > INACTIVE_TOKEN_ATTRIBUTE = AttributeKey .valueOf ("inactiveToken" );
33+
34+ private enum Inactive { INSTANCE }
3535
3636 public static Object getAttribute (Channel channel ) {
3737 Attribute <Object > attr = channel .attr (DEFAULT_ATTRIBUTE );
@@ -51,11 +51,11 @@ public static boolean isChannelValid(Channel channel) {
5151 }
5252
5353 public static void setInactiveToken (Channel channel ) {
54- channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).set (new AtomicBoolean ( true ) );
54+ channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).set (Inactive . INSTANCE );
5555 }
5656
5757 public static boolean getInactiveToken (Channel channel ) {
58- return channel != null && channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).get (). getAndSet (false ) ;
58+ return channel != null && channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).getAndSet (null ) != null ;
5959 }
6060
6161 public static ChannelId getChannelId (Channel channel ) {
You can’t perform that action at this time.
0 commit comments