Archived
0

Ping server

This commit is contained in:
2018-06-10 20:04:33 +03:00
parent 4a5f5cf721
commit 796076c97c
18 changed files with 825 additions and 1 deletions

View File

@@ -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);
}
};
}