Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@
package org.apache.rocketmq.remoting;

import java.util.Map;
import org.apache.rocketmq.logging.InternalLogger;
import org.apache.rocketmq.logging.InternalLoggerFactory;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.apache.rocketmq.remoting.common.RemotingUtil;
import org.apache.rocketmq.remoting.util.ServiceProvider;

public class RemotingClientFactory {
private static RemotingClientFactory instance = new RemotingClientFactory();

public static RemotingClientFactory getInstance(){
public static RemotingClientFactory getInstance() {
return instance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
package org.apache.rocketmq.remoting;

import java.util.Map;
import org.apache.rocketmq.logging.InternalLogger;
import org.apache.rocketmq.logging.InternalLoggerFactory;
import org.apache.rocketmq.remoting.common.RemotingHelper;
import org.apache.rocketmq.remoting.common.RemotingUtil;
import org.apache.rocketmq.remoting.util.ServiceProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@
package org.apache.rocketmq.remoting.common;

import io.netty.channel.Channel;
import org.apache.rocketmq.remoting.exception.RemotingConnectException;
import org.apache.rocketmq.remoting.exception.RemotingSendRequestException;
import org.apache.rocketmq.remoting.exception.RemotingTimeoutException;
import org.apache.rocketmq.logging.InternalLogger;
import org.apache.rocketmq.logging.InternalLoggerFactory;
import org.apache.rocketmq.remoting.protocol.RemotingCommand;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;


public class RemotingHelper {
public static final String ROCKETMQ_REMOTING = "RocketmqRemoting";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.rocketmq.remoting.netty;

import java.lang.annotation.Annotation;
Expand All @@ -10,8 +26,6 @@
import org.apache.rocketmq.remoting.annotation.CFNotNull;
import org.apache.rocketmq.remoting.exception.RemotingCommandException;
import org.apache.rocketmq.remoting.protocol.RemotingCommand;
import org.apache.rocketmq.remoting.serialize.RemotingSerializable;
import org.apache.rocketmq.remoting.serialize.RocketMQSerializable;
import org.apache.rocketmq.remoting.serialize.SerializeType;
import org.apache.rocketmq.remoting.serialize.Serializer;
import org.apache.rocketmq.remoting.serialize.SerializerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cm
responseFuture.release();
}
} else {
log.warn("receive response, but not matched any request: {} cmd: {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()), cmd);
log.warn("receive response, but not matched any request: {}, cmd: {}", RemotingHelper.parseChannelRemoteAddr(ctx.channel()), cmd);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Http2ClientImpl(final ClientConfig clientConfig,
init(clientConfig, channelEventListener);
}

public Http2ClientImpl(){
public Http2ClientImpl() {
super();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,26 +208,23 @@ public void start() {
final ChannelGroup channels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);
this.serverBootstrap.group(this.bossGroup, this.ioGroup).
channel(socketChannelClass).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
channels.add(ch);

ChannelPipeline cp = ch.pipeline();

cp.addLast(ChannelStatisticsHandler.NAME, new ChannelStatisticsHandler(channels));

cp.addLast(workerGroup,
Http2Handler.newHandler(true),
new NettyEncoder(),
new NettyDecoder(),
new IdleStateHandler(serverConfig.getConnectionChannelReaderIdleSeconds(),
serverConfig.getConnectionChannelWriterIdleSeconds(),
serverConfig.getServerChannelMaxIdleTimeSeconds()),
new NettyConnectManageHandler(),
new NettyServerHandler());
}
});
@Override
public void initChannel(SocketChannel ch) throws Exception {
channels.add(ch);

ChannelPipeline cp = ch.pipeline();
cp.addLast(ChannelStatisticsHandler.NAME, new ChannelStatisticsHandler(channels));
cp.addLast(workerGroup,
Http2Handler.newHandler(true),
new NettyEncoder(),
new NettyDecoder(),
new IdleStateHandler(serverConfig.getConnectionChannelReaderIdleSeconds(),
serverConfig.getConnectionChannelWriterIdleSeconds(),
serverConfig.getServerChannelMaxIdleTimeSeconds()),
new NettyConnectManageHandler(),
new NettyServerHandler());
}
});
applyOptions(serverBootstrap);

ChannelFuture channelFuture = this.serverBootstrap.bind(this.port).syncUninterruptibly();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.rocketmq.logging.InternalLogger;
import org.apache.rocketmq.logging.InternalLoggerFactory;
import org.apache.rocketmq.remoting.common.RemotingHelper;
Expand Down