Skip to content

Commit

Permalink
Netty 降级到4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
夜色 committed Aug 22, 2016
1 parent 64e9119 commit bb6c1fe
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
Expand Up @@ -52,7 +52,7 @@
* @author ohun@live.cn * @author ohun@live.cn
*/ */
@ChannelHandler.Sharable @ChannelHandler.Sharable
public final class ConnClientChannelHandler extends ChannelHandlerAdapter { public final class ConnClientChannelHandler extends ChannelInboundHandlerAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(ConnClientChannelHandler.class); private static final Logger LOGGER = LoggerFactory.getLogger(ConnClientChannelHandler.class);
private static final Timer HASHED_WHEEL_TIMER = new HashedWheelTimer(new PoolThreadFactory(ThreadNames.T_NETTY_TIMER)); private static final Timer HASHED_WHEEL_TIMER = new HashedWheelTimer(new PoolThreadFactory(ThreadNames.T_NETTY_TIMER));


Expand Down
Expand Up @@ -31,6 +31,7 @@
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter; import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;


Expand All @@ -42,7 +43,7 @@
* @author ohun@live.cn * @author ohun@live.cn
*/ */
@ChannelHandler.Sharable @ChannelHandler.Sharable
public final class GatewayClientChannelHandler extends ChannelHandlerAdapter { public final class GatewayClientChannelHandler extends ChannelInboundHandlerAdapter {


private static final Logger LOGGER = LoggerFactory.getLogger(GatewayClientChannelHandler.class); private static final Logger LOGGER = LoggerFactory.getLogger(GatewayClientChannelHandler.class);


Expand Down
Expand Up @@ -62,7 +62,7 @@ public AdminHandler(AdminServer adminServer) {
} }


@Override @Override
protected void messageReceived(ChannelHandlerContext ctx, String request) throws Exception { protected void channelRead0(ChannelHandlerContext ctx, String request) throws Exception {
Command command = Command.help; Command command = Command.help;
String arg = null; String arg = null;
String[] args = null; String[] args = null;
Expand Down
Expand Up @@ -119,7 +119,7 @@ public void onResponse(HttpResponse httpResponse) {
.from(request) .from(request)
.setStatusCode(httpResponse.status().code()) .setStatusCode(httpResponse.status().code())
.setReasonPhrase(httpResponse.status().reasonPhrase().toString()); .setReasonPhrase(httpResponse.status().reasonPhrase().toString());
for (Map.Entry<CharSequence, CharSequence> entry : httpResponse.headers()) { for (Map.Entry<String, String> entry : httpResponse.headers()) {
response.addHeader(entry.getKey().toString(), entry.getValue().toString()); response.addHeader(entry.getKey().toString(), entry.getValue().toString());
} }


Expand Down
Expand Up @@ -30,8 +30,8 @@
import com.mpush.tools.event.EventBus; import com.mpush.tools.event.EventBus;
import com.mpush.tools.log.Logs; import com.mpush.tools.log.Logs;
import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;


Expand All @@ -41,7 +41,7 @@
* @author ohun@live.cn * @author ohun@live.cn
*/ */
@ChannelHandler.Sharable @ChannelHandler.Sharable
public final class ServerChannelHandler extends ChannelHandlerAdapter { public final class ServerChannelHandler extends ChannelInboundHandlerAdapter {


private static final Logger LOGGER = LoggerFactory.getLogger(ServerChannelHandler.class); private static final Logger LOGGER = LoggerFactory.getLogger(ServerChannelHandler.class);


Expand Down
@@ -1,8 +1,8 @@
package com.mpush.netty.http; package com.mpush.netty.http;


import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.http.*; import io.netty.handler.codec.http.*;
import io.netty.util.IllegalReferenceCountException; import io.netty.util.IllegalReferenceCountException;
import io.netty.util.ReferenceCountUtil; import io.netty.util.ReferenceCountUtil;
Expand All @@ -13,7 +13,7 @@
import java.net.URLDecoder; import java.net.URLDecoder;


@ChannelHandler.Sharable @ChannelHandler.Sharable
public class HttpClientHandler extends ChannelHandlerAdapter { public class HttpClientHandler extends ChannelInboundHandlerAdapter {
private static final Logger LOGGER = LoggerFactory.getLogger(NettyHttpClient.class); private static final Logger LOGGER = LoggerFactory.getLogger(NettyHttpClient.class);
private final NettyHttpClient client; private final NettyHttpClient client;


Expand Down
Expand Up @@ -48,8 +48,9 @@ public RequestContext(FullHttpRequest request, HttpCallback callback) {
} }


private int parseTimeout() { private int parseTimeout() {
String timeout = request.headers().getAndRemoveAndConvert(Constants.HTTP_HEAD_READ_TIMEOUT); String timeout = request.headers().get(Constants.HTTP_HEAD_READ_TIMEOUT);
if (timeout != null) { if (timeout != null) {
request.headers().remove(Constants.HTTP_HEAD_READ_TIMEOUT);
Integer integer = Ints.tryParse(timeout); Integer integer = Ints.tryParse(timeout);
if (integer != null && integer > 0) { if (integer != null && integer > 0) {
return integer; return integer;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -62,7 +62,7 @@
<mpush-boot-version>${mpush.version}</mpush-boot-version> <mpush-boot-version>${mpush.version}</mpush-boot-version>
<mpush-test-version>${mpush.version}</mpush-test-version> <mpush-test-version>${mpush.version}</mpush-test-version>
<mpush-zk-version>${mpush.version}</mpush-zk-version> <mpush-zk-version>${mpush.version}</mpush-zk-version>
<netty.version>5.0.0.Alpha2</netty.version> <netty.version>4.1.4.Final</netty.version>
<os.detected.classifier>linux-x86_64</os.detected.classifier> <os.detected.classifier>linux-x86_64</os.detected.classifier>
</properties> </properties>


Expand Down

0 comments on commit bb6c1fe

Please sign in to comment.