@Configuration
@ConditionalOnNacosDiscoveryEnabled
public class NacosAutoConfiguration {
@Bean
public RouteProperties routeProperties() {
return new RouteProperties();
}
@Bean
public NacosNamingService nacosNamingService() {
return new NacosNamingService();
}
@Bean
@Scope("prototype")
public IRule getRibbonRule() {
return new NacosWeightLoadBalancerRule();
}
}
@Slf4j
@Configuration
@ConditionalOnRouteEnabled
public class RouteAutoConfiguration {
@Autowired(required = false)
private RouteProperties routeProperties;
@Value("${spring.cloud.nacos.discovery.namespace:}")
private String namespace;
@PostConstruct
public void init() {
NacosExecutorService.setBaseUrl(routeProperties.getAddress());
NacosPullInstanceWorker worker = new NacosPullInstanceWorker();
//保存路由信息交由线程池执行
worker.run();
int period = routeProperties.getPeriod();
NacosExecutorService nacosExecutorService = new NacosExecutorService("nacos-pull-instance");
nacosExecutorService.execute(period, worker);
}
}
//创建一个调度线程执行拉取服务列表
public class NacosExecutorService {
final ScheduledExecutorService executorService;
private static String baseUrl;
public static String getBaseUrl() {
return baseUrl;
}
public static void setBaseUrl(String baseUrl) {
NacosExecutorService.baseUrl = baseUrl;
}
public void execute(int period, Runnable task) {
executorService.scheduleWithFixedDelay(task, 3, period, TimeUnit.SECONDS);
}
public NacosExecutorService(String name) {
executorService = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors(), new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setName(name);
t.setDaemon(true);
return t;
}
});
}
}
//拉取服务线程实例
@Slf4j
public class NacosPullInstanceWorker implements Runnable {
@Override
public void run() {
HashMap
openjdk上关于hotspot将移除永久带的描述非常详细,http://openjdk.java.net/jeps/122
JEP 122: Remove the Permanent Generation
Author Jon Masamitsu
Organization Oracle
Created 2010/8/15
Updated 2011/
PL/SQL也是一门高级语言,所以流程控制是必须要有的,oracle数据库的pl/sql比sqlserver数据库要难,很多pl/sql中有的sqlserver里面没有
流程控制;
分支语句 if 条件 then 结果 else 结果 end if ;
条件语句 case when 条件 then 结果;
循环语句 loop
/*
*开发子程序
*/
--子程序目是指被命名的PL/SQL块,这种块可以带有参数,可以在不同应用程序中多次调用
--PL/SQL有两种类型的子程序:过程和函数
--开发过程
--建立过程:不带任何参数
CREATE OR REPLACE PROCEDURE out_time
IS
BEGIN
DBMS_OUTPUT.put_line(systimestamp);
E
long 长的
show 给...看,出示
mouth 口,嘴
write 写
use 用,使用
take 拿,带来
hand 手
clever 聪明的
often 经常
wash 洗
slow 慢的
house 房子
water 水
clean 清洁的
supper 晚餐
out 在外
face 脸,