Ping server
This commit is contained in:
@@ -23,7 +23,9 @@ import org.springframework.context.ApplicationContext;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class NettyServer implements Server {
|
||||
@@ -56,7 +58,10 @@ public class NettyServer implements Server {
|
||||
@Override
|
||||
protected void initChannel(SocketChannel socketChannel) {
|
||||
Map<String, ChannelHandler> beans = applicationContext.getBeansOfType(ChannelHandler.class);
|
||||
beans.forEach(socketChannel.pipeline()::addLast);
|
||||
beans.entrySet().stream()
|
||||
.sorted((e1, e2) -> e1.getKey().compareToIgnoreCase(e2.getKey()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))
|
||||
.forEach(socketChannel.pipeline()::addLast);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user