Skip to content

Commit 6a2567e

Browse files
author
Stephane Landelle
committed
Drop Netty Provider OIO support, close AsyncHttpClient#398
1 parent 3345697 commit 6a2567e

File tree

2 files changed

+12
-40
lines changed

2 files changed

+12
-40
lines changed

providers/netty/src/main/java/org/asynchttpclient/providers/netty/NettyAsyncHttpProviderConfig.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ public class NettyAsyncHttpProviderConfig implements AsyncHttpProviderConfig<Str
4040

4141
private final static Logger LOGGER = LoggerFactory.getLogger(NettyAsyncHttpProviderConfig.class);
4242

43-
/**
44-
* Use Netty's blocking IO stategy.
45-
*/
46-
private boolean useBlockingIO;
47-
4843
/**
4944
* Allow configuring the Netty's event loop.
5045
*/
@@ -147,14 +142,6 @@ public Set<Map.Entry<String, Object>> propertiesSet() {
147142
return properties.entrySet();
148143
}
149144

150-
public boolean isUseBlockingIO() {
151-
return useBlockingIO;
152-
}
153-
154-
public void setUseBlockingIO(boolean useBlockingIO) {
155-
this.useBlockingIO = useBlockingIO;
156-
}
157-
158145
public EventLoopGroup getEventLoopGroup() {
159146
return eventLoopGroup;
160147
}

providers/netty/src/main/java/org/asynchttpclient/providers/netty/channel/Channels.java

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
import io.netty.channel.EventLoopGroup;
2626
import io.netty.channel.group.ChannelGroup;
2727
import io.netty.channel.nio.NioEventLoopGroup;
28-
import io.netty.channel.oio.OioEventLoopGroup;
29-
import io.netty.channel.socket.SocketChannel;
3028
import io.netty.channel.socket.nio.NioSocketChannel;
31-
import io.netty.channel.socket.oio.OioSocketChannel;
3229
import io.netty.handler.codec.http.HttpClientCodec;
3330
import io.netty.handler.codec.http.HttpContentCompressor;
3431
import io.netty.handler.codec.http.HttpContentDecompressor;
@@ -112,34 +109,22 @@ public Channels(final AsyncHttpClientConfig config, NettyAsyncHttpProviderConfig
112109
this.config = config;
113110
this.asyncHttpProviderConfig = asyncHttpProviderConfig;
114111

115-
Class<? extends SocketChannel> socketChannelClass = null;
116-
if (asyncHttpProviderConfig.isUseBlockingIO()) {
117-
socketChannelClass = OioSocketChannel.class;
118-
eventLoopGroup = new OioEventLoopGroup();
119-
allowReleaseEventLoopGroup = true;
112+
// check if external EventLoopGroup is defined
113+
eventLoopGroup = asyncHttpProviderConfig.getEventLoopGroup();
120114

115+
if (eventLoopGroup == null) {
116+
eventLoopGroup = new NioEventLoopGroup();
117+
allowReleaseEventLoopGroup = true;
121118
} else {
122-
// check if external EventLoopGroup is defined
123-
eventLoopGroup = asyncHttpProviderConfig.getEventLoopGroup();
124-
if (eventLoopGroup instanceof OioEventLoopGroup) {
125-
socketChannelClass = OioSocketChannel.class;
126-
allowReleaseEventLoopGroup = false;
127-
128-
} else if (eventLoopGroup instanceof NioEventLoopGroup) {
129-
socketChannelClass = NioSocketChannel.class;
130-
allowReleaseEventLoopGroup = false;
131-
132-
} else {
133-
socketChannelClass = NioSocketChannel.class;
134-
eventLoopGroup = new NioEventLoopGroup();
135-
allowReleaseEventLoopGroup = true;
136-
}
119+
if (!(eventLoopGroup instanceof NioEventLoopGroup))
120+
throw new IllegalArgumentException("Only Nio is supported");
121+
allowReleaseEventLoopGroup = false;
137122
}
138123

139-
plainBootstrap = new Bootstrap().channel(socketChannelClass).group(eventLoopGroup);
140-
secureBootstrap = new Bootstrap().channel(socketChannelClass).group(eventLoopGroup);
141-
webSocketBootstrap = new Bootstrap().channel(socketChannelClass).group(eventLoopGroup);
142-
secureWebSocketBootstrap = new Bootstrap().channel(socketChannelClass).group(eventLoopGroup);
124+
plainBootstrap = new Bootstrap().channel(NioSocketChannel.class).group(eventLoopGroup);
125+
secureBootstrap = new Bootstrap().channel(NioSocketChannel.class).group(eventLoopGroup);
126+
webSocketBootstrap = new Bootstrap().channel(NioSocketChannel.class).group(eventLoopGroup);
127+
secureWebSocketBootstrap = new Bootstrap().channel(NioSocketChannel.class).group(eventLoopGroup);
143128

144129
// This is dangerous as we can't catch a wrong typed ConnectionsPool
145130
ConnectionsPool<String, Channel> cp = (ConnectionsPool<String, Channel>) config.getConnectionsPool();

0 commit comments

Comments
 (0)