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
3230private static final AttributeKey <Object >DEFAULT_ATTRIBUTE =AttributeKey .valueOf ("default" );
3331private 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
3636public static Object getAttribute (Channel channel ) {
3737Attribute <Object >attr =channel .attr (DEFAULT_ATTRIBUTE );
@@ -51,11 +51,11 @@ public static boolean isChannelValid(Channel channel) {
5151 }
5252
5353public 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
5757public 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
6161public static ChannelId getChannelId (Channel channel ) {