/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
* http://www.apache.org/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.alipay.sofa.rpc.boot.config;
import com.alipay.sofa.rpc.common.SofaOptions;
import com.google.common.base.CaseFormat;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
/**
* @author khotyn
*/
@ConfigurationProperties(SofaBootRpcProperties.PREFIX)
public class SofaBootRpcProperties implements EnvironmentAware {
public static final String PREFIX = "com.alipay.sofa.rpc";
private Environment environment;
/**
* whether regulation effective (是否开启单机故障剔除功能)
*/
private String aftRegulationEffective;
/**
* whether regulation effective (是否开启降级)
*/
private String aftDegradeEffective;
/**
* aft time window of caculation (时间窗口)
*/
private String aftTimeWindow;
/**
* aft least invoke times in window (最小调用次数)
*/
private String aftLeastWindowCount;
/**
* aft least exception rate multiple than average exception rate (最小异常率)
*/
private String aftLeastWindowExceptionRateMultiple;
/**
* aft weight was degraded by this rate (降级速率)
*/
private String aftWeightDegradeRate;
/**
* aft weight was recovered by this rate (恢复速率)
*/
private String aftWeightRecoverRate;
/**
* the least weight that aft could degrade one provider (降级最小权重)
*/
private String aftDegradeLeastWeight;
/**
* the max ip numbers that aft could degrade (最大降级 ip)
*/
private String aftDegradeMaxIpCount;
/* fault-tolerance end */
/* Bolt start*/
/**
* the port of bolt (bolt 端口)
*/
private String boltPort;
/**
* the core thread pool size of bolt (bolt 核心线程数)
*/
private String boltThreadPoolCoreSize;
/**
* the max thread pool size of bolt (bolt 最大线程数)
*/
private String boltThreadPoolMaxSize;
/**
* the queue size of bolt server(bolt 线程池队列)
*/
private String boltThreadPoolQueueSize;
/**
* the max accept size of bolt (bolt 服务端允许客户端建立的连接数)
*/
private String boltAcceptsSize;
/**
* process in bolt io worker thread (bolt 服务端业务处理是否直接在worker中处理)
*/
private Boolean boltProcessInIoThread;
/**
* export a port to show swagger
*/
private Boolean enableSwagger;
/**
* Location of remote mock server . If specified ,auto enable mock.
*/
private String mockUrl;
/* Bolt end*/
/* H2c start*/
/**
* the port of http2 (http2 端口)
*/
private String h2cPort;
/**
* the core thread pool size of http2 (http2 核心线程数)
*/
private String h2cThreadPoolCoreSize;
/**
* the max thread pool size of http2 (http2 最大线程数)
*/
private String h2cThreadPoolMaxSize;
/**
* the queue size of http2 server(http2 线程池队列)
*/
private String h2cThreadPoolQueueSize;
/**
* the max accept size of http2 (http2 服务端允许客户端建立的连接数)
*/
private String h2cAcceptsSize;
/* Bolt end*/
/* rest start*/
/**
* rest host name (rest 绑定的 hostname)
*/
private String restHostname;
/**
* the port of rest (rest 端口)
*/
private String restPort;
/**
* the io thread size of rest io (rest io 线程数)
*/
private String restIoThreadSize;
/**
* rest context path (rest context path)
*/
private String restContextPath;
/**
* cors settings
*/
private String restAllowedOrigins;
// has no use
/**
* the core thread pool size of rest (rest 核心线程数)
*/
private String restThreadPoolCoreSize;
/**
* the max thread pool size of rest (rest 最大线程数)
*/
private String restThreadPoolMaxSize;
/**
* the max request size of per request (rest 最大请求大小)
*/
private String restMaxRequestSize;
/**
* whether allow rest telnet (是否允许 rest telnet)
*/
private String restTelnet;
/**
* whether rest server is daemon (是否hold住端口,true的话随主线程退出而退出)
*/
private String restDaemon;
private boolean restSwagger;
/* rest end */
/* dubbo start*/
/**
* the port of dubbo (dubbo 端口)
*/
private String dubboPort;
/**
* the io thread size of dubbo io (dubbo io 线程数)
*/
private String dubboIoThreadSize;
//has no use
/**
* the core thread pool size of dubbo (dubbo 核心线程数)
*/
private String dubboThreadPoolCoreSize;
/**
* the max thread pool size of dubbo (dubbo 最大线程数)
*/
private String dubboThreadPoolMaxSize;
//has no use
/**
* the queue size of dubbo server(dubbo 线程池队列)
*/
private String dubboThreadPoolQueueSize;
/**
* the max accept size of dubbo (dubbo 服务端允许客户端建立的连接数)
*/
private String dubboAcceptsSize;
/* dubbo end*/
/* http start*/
/**
* the port of http (http 端口)
*/
private String httpPort;
/**
* the core thread pool size of http (http 核心线程数)
*/
private String httpThreadPoolCoreSize;
/**
* the max thread pool size of http (http 最大线程数)
*/
private String httpThreadPoolMaxSize;
/**
* the queue size of http server(http 线程池队列)
*/
private String httpThreadPoolQueueSize;
/**
* the max accept size of http (http 服务端允许客户端建立的连接数)
*/
private String httpAcceptsSize;
/* http end*/
/* triple start*/
/**
* the port of triple (triple 端口)
*/
private String triplePort;
/**
* the core thread pool size of triple (triple 核心线程数)
*/
private String tripleThreadPoolCoreSize;
/**
* the max thread pool size of triple (triple 最大线程数)
*/
private String tripleThreadPoolMaxSize;
/**
* the queue size of triple server(triple 线程池队列)
*/
private String tr