From 14a7e47e3a1d63ffc16417460f237a4c89fef110 Mon Sep 17 00:00:00 2001 From: crusader Date: Tue, 24 Apr 2018 19:38:25 +0900 Subject: [PATCH] ing --- .../com/loafle/overflow/container/Container.java | 5 +++-- .../configuration/ContainerConfiguration.java | 12 ++++++++++-- .../overflow/container/service/CrawlerService.java | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/loafle/overflow/container/Container.java b/src/main/java/com/loafle/overflow/container/Container.java index 6ef48be..16960ac 100644 --- a/src/main/java/com/loafle/overflow/container/Container.java +++ b/src/main/java/com/loafle/overflow/container/Container.java @@ -4,6 +4,7 @@ package com.loafle.overflow.container; * Container */ public class Container { - public static final String CONTAINER_CRAWLERS = "CONTAINER_CRAWLERS"; - + public static final String CRAWLERS = "CONTAINER_CRAWLERS"; + public static final String PIPELINE_CHANNEL_HANDLERS = "CONTAINER_PIPELINE_CHANNEL_HANDLERS"; + } \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/container/configuration/ContainerConfiguration.java b/src/main/java/com/loafle/overflow/container/configuration/ContainerConfiguration.java index f8f7dad..cd08911 100644 --- a/src/main/java/com/loafle/overflow/container/configuration/ContainerConfiguration.java +++ b/src/main/java/com/loafle/overflow/container/configuration/ContainerConfiguration.java @@ -12,9 +12,11 @@ import com.loafle.commons.rpc.registry.RPCRegistry; import com.loafle.commons.rpc.registry.pojo.POJORPCRegistry; import com.loafle.commons.server.Server; import com.loafle.commons.server.socket.handler.codec.SocketServerProtocolHandler; +import com.loafle.overflow.container.Container; import com.loafle.overflow.container.server.handler.RPCServerHandler; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -34,22 +36,26 @@ import io.netty.handler.logging.LoggingHandler; @Configuration public class ContainerConfiguration { @Autowired + @Qualifier(Container.PIPELINE_CHANNEL_HANDLERS) private List pipelineChannelHandlers; - @Autowired + @Autowired(required=false) private Gson gson; - @Bean + @Bean() + @Qualifier(Server.CHANNEL_CLASS) public Class channelClass() { return NioServerSocketChannel.class; } @Bean + @Qualifier(Server.CHANNEL_OPTIONS) public List> channelOptions() { return Arrays.asList(new Server.ChannelOptionItem<>(ChannelOption.SO_BACKLOG, 100)); } @Bean + @Qualifier(Server.CHANNEL_HANDLER) public ChannelHandler channelHandler() { return new LoggingHandler(LogLevel.INFO); } @@ -69,6 +75,7 @@ public class ContainerConfiguration { } @Bean + @Qualifier(Server.CHANNEL_INITIALIZER) public ChannelInitializer channelInitializer() { return new ChannelInitializer() { @Override @@ -84,6 +91,7 @@ public class ContainerConfiguration { } @Bean + @Qualifier(Server.SOCKET_ADDRESS) public SocketAddress address() { return new InetSocketAddress("127.0.0.1", 60000); } diff --git a/src/main/java/com/loafle/overflow/container/service/CrawlerService.java b/src/main/java/com/loafle/overflow/container/service/CrawlerService.java index df01c0c..a88b537 100644 --- a/src/main/java/com/loafle/overflow/container/service/CrawlerService.java +++ b/src/main/java/com/loafle/overflow/container/service/CrawlerService.java @@ -25,7 +25,7 @@ public class CrawlerService implements Service { @Autowired private SensorConfigService sensorConfigService; - @Resource(name=Container.CONTAINER_CRAWLERS) + @Resource(name=Container.CRAWLERS) private Map crawlers; @Override