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 13
13
*/
14
14
package org .asynchttpclient .netty .channel ;
15
15
16
- import java .util .concurrent .atomic .AtomicBoolean ;
17
-
18
16
import io .netty .channel .Channel ;
19
17
import io .netty .channel .ChannelId ;
20
18
import io .netty .channel .DefaultChannelId ;
@@ -31,7 +29,9 @@ public class Channels {
31
29
32
30
private static final AttributeKey <Object > DEFAULT_ATTRIBUTE = AttributeKey .valueOf ("default" );
33
31
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 }
35
35
36
36
public static Object getAttribute (Channel channel ) {
37
37
Attribute <Object > attr = channel .attr (DEFAULT_ATTRIBUTE );
@@ -51,11 +51,11 @@ public static boolean isChannelValid(Channel channel) {
51
51
}
52
52
53
53
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 );
55
55
}
56
56
57
57
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 ;
59
59
}
60
60
61
61
public static ChannelId getChannelId (Channel channel ) {
You can’t perform that action at this time.
0 commit comments