【DUBBO】Dubbo:protocol的配置项
【⼀】:配置项
<dubbo:protocol id="标识" port="端⼝号" name="名字"/>
View Code
【⼆】:配置解析器
-->具体解析器为com.fig.spring.schema.DubboNamespaceHandler配置的
com.fig.spring.schema.DubboBeanDefinitionParser、
【三】:配置⽬标
-->这个配置会向IOC容器中注册⼀个bean,该class为com.fig.ProtocolConfig
-->这个bean描述当前项⽬使⽤的协议的相关信息。
-->描述属性:id,name(服务协议),host(服务IP地址(多⽹卡时使⽤)),port(服务端⼝),contextpath(上下⽂路径),threadpool(线程池类
型),threads(线程池⼤⼩(固定⼤⼩)),iothreads(IO线程池⼤⼩(固定⼤⼩)),queues(线程池队列⼤⼩),accepts(最⼤接收连接数),codec(协议编码),serialization(序列化⽅式),charset(字符集),payload(最⼤请求数据长度),buffer(缓存区⼤⼩),heartbeat(⼼跳间隔),accesslog(访问⽇
志),transporter( ⽹络传输⽅式),exchanger(信息交换⽅式),dispatcher(信息线程模型派发⽅式),networker(对称⽹络组⽹⽅式),server(服务器端实现),client(客户端实现),telnet(⽀持的telnet命令,多个命令⽤逗号分隔),prompt(命令⾏提⽰符),status(status检查),register(是否注
册),keepAlive(是否长连接),optimizer(序列化的优化器的实现类名),extension(扩展参数),parameters(参数),isDefault(是否为缺省)【四】:类
/*
* Copyright 1999-2011 Alibaba Group.
*
* Licensed 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
*
* /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 com.fig;
import java.util.Map;
import com.sion.ExtensionLoader;
import com.alibaba.dubbomon.serialize.Serialization;
import com.alibaba.dubbomon.status.StatusChecker;
import com.alibaba.dubbomon.threadpool.ThreadPool;
import com.fig.support.Parameter;
import com.istry.support.AbstractRegistryFactory;
import com.ing.Dispatcher;
import com.ing.Codec;
import com.ing.Transporter;
import com.hange.Exchanger;
import com.lnet.TelnetHandler;
import com.alibaba.dubbo.rpc.Protocol;
/**
* ProtocolConfig
*
* @author william.liangf
* @export
*/
public class ProtocolConfig extends AbstractConfig {
private static final long serialVersionUID = 6913423882496634749L;
// 服务协议
private String name;
// 服务IP地址(多⽹卡时使⽤)
private String host;
java dubbo// 服务端⼝
private Integer port;
// 上下⽂路径
private String contextpath;
// 线程池类型
private String threadpool;
// 线程池⼤⼩(固定⼤⼩)
private Integer threads;
/
/ IO线程池⼤⼩(固定⼤⼩)
private Integer iothreads;
// 线程池队列⼤⼩
private Integer queues;
// 最⼤接收连接数
private Integer accepts;
// 协议编码
private String codec;
// 序列化⽅式
private String serialization;
// 字符集
private String charset;
// 最⼤请求数据长度
private Integer payload;
// 缓存区⼤⼩
private Integer buffer;
// ⼼跳间隔
private Integer heartbeat;
// 访问⽇志
private String accesslog;
// ⽹络传输⽅式
private String transporter;
/
/ 信息交换⽅式
private String exchanger;
// 信息线程模型派发⽅式
private String dispatcher;
// 对称⽹络组⽹⽅式
private String networker;
// 服务器端实现
private String server;
// 客户端实现
private String client;
// ⽀持的telnet命令,多个命令⽤逗号分隔private String telnet;
/
/ 命令⾏提⽰符
private String prompt;
// status检查
private String status;
// 是否注册
private Boolean register;
// 是否长连接
// TODO add this to provider config private Boolean keepAlive;
// 序列化的优化器的实现类名
// TODO add this to provider config private String optimizer;
private String extension;
/
/ 参数
private Map<String, String> parameters; // 是否为缺省
private Boolean isDefault;
public ProtocolConfig() {
}
public ProtocolConfig(String name) {
setName(name);
}
public ProtocolConfig(String name, int port) {
setName(name);
setPort(port);
}
@Parameter(excluded = true)
public String getName() {
return name;
}
public void setName(String name) {
checkName("name", name);
this.name = name;
if (id == null || id.length() == 0) {
id = name;
}
}
@Parameter(excluded = true)
public String getHost() {
return host;
}
public void setHost(String host) {
checkName("host", host);
this.host = host;
}
@Parameter(excluded = true)
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
@Deprecated
@Parameter(excluded = true)
public String getPath() {
return getContextpath();
}
@Deprecated
public void setPath(String path) {
setContextpath(path);
}
@Parameter(excluded = true)
public String getContextpath() {
return contextpath;
}
public void setContextpath(String contextpath) {
checkPathName("contextpath", contextpath);
}
public String getThreadpool() {
return threadpool;
}
public void setThreadpool(String threadpool) {
checkExtension(ThreadPool.class, "threadpool", threadpool);
this.threadpool = threadpool;
}
public Integer getThreads() {
return threads;
}
public void setThreads(Integer threads) {
this.threads = threads;
}
public Integer getIothreads() {
return iothreads;
}
public void setIothreads(Integer iothreads) {
this.iothreads = iothreads;
}
public Integer getQueues() {
return queues;
}
public void setQueues(Integer queues) {
this.queues = queues;
}
public Integer getAccepts() {
return accepts;
}
public void setAccepts(Integer accepts) {
this.accepts = accepts;
}
public String getCodec() {
return codec;
}
public void setCodec(String codec) {
if ("dubbo".equals(name)) {
checkMultiExtension(Codec.class, "codec", codec);
}
}
public String getSerialization() {
return serialization;
}
public void setSerialization(String serialization) {
if ("dubbo".equals(name)) {
checkMultiExtension(Serialization.class, "serialization", serialization); }
this.serialization = serialization;
}
public String getCharset() {
return charset;
}
public void setCharset(String charset) {
this.charset = charset;
}
public Integer getPayload() {
return payload;
}
public void setPayload(Integer payload) {
this.payload = payload;
}
public Integer getBuffer() {
return buffer;
}
public void setBuffer(Integer buffer) {
this.buffer = buffer;
}
public Integer getHeartbeat() {
return heartbeat;
}
public void setHeartbeat(Integer heartbeat) {
this.heartbeat = heartbeat;
}
public String getServer() {
return server;
}
public void setServer(String server) {
if ("dubbo".equals(name)) {
checkMultiExtension(Transporter.class, "server", server); }
this.server = server;
}
public String getClient() {
return client;
}
public void setClient(String client) {
if ("dubbo".equals(name)) {
checkMultiExtension(Transporter.class, "client", client); }
this.client = client;
}
public String getAccesslog() {
return accesslog;
}
public void setAccesslog(String accesslog) {
this.accesslog = accesslog;
}
public String getTelnet() {
return telnet;
}
public void setTelnet(String telnet) {
checkMultiExtension(TelnetHandler.class, "telnet", telnet);
}
@Parameter(escaped = true)
public String getPrompt() {
return prompt;
}
public void setPrompt(String prompt) {
this.prompt = prompt;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
checkMultiExtension(StatusChecker.class, "status", status);
this.status = status;
}
public Boolean isRegister() {
return register;
}
public void setRegister(Boolean register) {
}
public String getTransporter() {
return transporter;
}
public void setTransporter(String transporter) {
checkExtension(Transporter.class, "transporter", transporter);
}
public String getExchanger() {
return exchanger;
}
public void setExchanger(String exchanger) {
checkExtension(Exchanger.class, "exchanger", exchanger);
}
/**
* 单词拼写错误,请使⽤{@link #getDispatcher()}
* @deprecated {@link #getDispatcher()}
*/
@Deprecated
@Parameter(excluded = true)
public String getDispather() {
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论