Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita80a011

Browse files
stepanchegslandelle
authored andcommitted
Unnecessary AtomicBoolean in inactive token attribute (AsyncHttpClient#1378)
1 parentd735d7b commita80a011

File tree

1 file changed

+5
-5
lines changed
  • client/src/main/java/org/asynchttpclient/netty/channel

1 file changed

+5
-5
lines changed

‎client/src/main/java/org/asynchttpclient/netty/channel/Channels.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
*/
1414
packageorg.asynchttpclient.netty.channel;
1515

16-
importjava.util.concurrent.atomic.AtomicBoolean;
17-
1816
importio.netty.channel.Channel;
1917
importio.netty.channel.ChannelId;
2018
importio.netty.channel.DefaultChannelId;
@@ -31,7 +29,9 @@ public class Channels {
3129

3230
privatestaticfinalAttributeKey<Object>DEFAULT_ATTRIBUTE =AttributeKey.valueOf("default");
3331
privatestaticfinalAttributeKey<ChannelId>CHANNEL_ID_ATTRIBUTE =AttributeKey.valueOf("channelId");
34-
privatestaticfinalAttributeKey<AtomicBoolean>INACTIVE_TOKEN_ATTRIBUTE =AttributeKey.valueOf("inactiveToken");
32+
privatestaticfinalAttributeKey<Inactive>INACTIVE_TOKEN_ATTRIBUTE =AttributeKey.valueOf("inactiveToken");
33+
34+
privateenumInactive {INSTANCE }
3535

3636
publicstaticObjectgetAttribute(Channelchannel) {
3737
Attribute<Object>attr =channel.attr(DEFAULT_ATTRIBUTE);
@@ -51,11 +51,11 @@ public static boolean isChannelValid(Channel channel) {
5151
}
5252

5353
publicstaticvoidsetInactiveToken(Channelchannel) {
54-
channel.attr(INACTIVE_TOKEN_ATTRIBUTE).set(newAtomicBoolean(true));
54+
channel.attr(INACTIVE_TOKEN_ATTRIBUTE).set(Inactive.INSTANCE);
5555
}
5656

5757
publicstaticbooleangetInactiveToken(Channelchannel) {
58-
returnchannel !=null &&channel.attr(INACTIVE_TOKEN_ATTRIBUTE).get().getAndSet(false);
58+
returnchannel !=null &&channel.attr(INACTIVE_TOKEN_ATTRIBUTE).getAndSet(null) !=null;
5959
}
6060

6161
publicstaticChannelIdgetChannelId(Channelchannel) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp