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 1717import io .netty .util .Attribute ;
1818import io .netty .util .AttributeKey ;
1919
20- import java .util .concurrent .atomic .AtomicBoolean ;
21-
2220import org .asynchttpclient .netty .DiscardEvent ;
2321import org .slf4j .Logger ;
2422import org .slf4j .LoggerFactory ;
@@ -28,7 +26,9 @@ public class Channels {
2826 private static final Logger LOGGER = LoggerFactory .getLogger (Channels .class );
2927
3028 private static final AttributeKey <Object > DEFAULT_ATTRIBUTE = AttributeKey .valueOf ("default" );
31- private static final AttributeKey <AtomicBoolean > INACTIVE_TOKEN_ATTRIBUTE = AttributeKey .valueOf ("inactiveToken" );
29+ private static final AttributeKey <Inactive > INACTIVE_TOKEN_ATTRIBUTE = AttributeKey .valueOf ("inactiveToken" );
30+
31+ private enum Inactive { INSTANCE }
3232
3333 public static Object getAttribute (Channel channel ) {
3434 Attribute <Object > attr = channel .attr (DEFAULT_ATTRIBUTE );
@@ -48,11 +48,11 @@ public static boolean isChannelValid(Channel channel) {
4848 }
4949
5050 public static void setInactiveToken (Channel channel ) {
51- channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).set (new AtomicBoolean ( true ) );
51+ channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).set (Inactive . INSTANCE );
5252 }
5353
5454 public static boolean getInactiveToken (Channel channel ) {
55- return channel != null && channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).get (). getAndSet (false ) ;
55+ return channel != null && channel .attr (INACTIVE_TOKEN_ATTRIBUTE ).getAndSet (null ) != null ;
5656 }
5757
5858 public static void silentlyCloseChannel (Channel channel ) {
You can’t perform that action at this time.
0 commit comments