tech.guyi.component.channel.defaults.AbstractMessageChannel Maven / Gradle / Ivy
The newest version!
package tech.guyi.component.channel.defaults;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import tech.guyi.component.channel.MessageChannel;
import tech.guyi.component.channel.MessageChannelOption;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
/**
* 消息管道抽象类
* 集成较为通用部分功能
* @author guyi
* @version 2021/1/12 15:52
*/
public abstract class AbstractMessageChannel implements MessageChannel {
// 线程组
private EventLoopGroup group;
// 配置项集合
private final Map, Object> options;
public AbstractMessageChannel() {
options = new HashMap<>();
}
@Override
public Map, Object> options() {
return options;
}
@Override
public MessageChannel option(MessageChannelOption key, T value) {
options.put((MessageChannelOption