自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(69)
  • 收藏
  • 关注

原创 线上CPU 100%问题排查

5、分析具体线程ID的堆栈(16进制),看看是否有BLOCKED状态或者WAITING状态。4、使用命令 jstack -l %ThreadId > cc.txt 保存线程堆栈信息。3、使用命令 top -Hp %ThreadId 查看进程中具体线程使用CPU情况。2、使用top命令查看占用CPU高的进程。1、安装jdk工具 jstack。

2024-07-16 10:52:21 264

原创 Jenkins+k8s CI(持续集成)/CD(持续部署)

注意:正常情况下会自动创建root用户并在/etc/gitlab/initial_root_password里面有密码,修改配置:(不然执行shell会报错,没有权限)推送过程略,新建过后有说明,按说明操作即可。后面设置账号密码及配置访问url就完成了。步骤1:修改docker配置。步骤3:查看推送镜像命令。

2022-10-07 17:00:34 1479

原创 helm实战

下载helm包解压和移动验证。

2022-09-06 09:48:51 555

原创 Java Agent 概念及实操

java agent

2022-07-18 16:54:20 648

原创 KVM环境搭建和运行(VMvare15,centos7)

1、先下载centos镜像Index of /centos/7.9.2009/isos/x86_64/2、VMvare新建虚拟机并安装镜像,分配50G以上硬盘空间,4G内存、4CPU、勾选虚拟化Intel VT-x/EPT选项。下图注意勾选3、下载KVM源码KVM作为Linux kernel中的一个module而存在,是从Linux 2.6.20版本开始被完全正式 加入内核的主干开发和正式发布代码中。所以,只需要下载2.6.20以上版本,Linux kernel代码 ...

2022-04-29 17:43:56 707

原创 tomcat 部署多服务

1、同端口、HOST、不同路径方式<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <!-- 服务1,访问路径为 localhost:8080/a/xxxx --> <Context path="/a" docBase="art-test1-0.0.1-SNAPSHOT" reloadable="true"&

2022-04-29 16:59:58 508

原创 Java程序优雅关闭

1、main函数public static void main(String[] args) { System.out.println("start"); Runtime.getRuntime().addShutdownHook(new Thread(()->{ System.out.println("Shutdown start!!!"); try { Thread.sleep(2000); } catch (InterruptedException e) {

2022-04-14 10:57:43 3237

原创 arthas使用实践

1、热替换代码1.修改代码并copy到指定目录,如D:\arttest\demo\MathGame.java2.进入arthas执行编译命令mc D:/arttest/demo/MathGame.java -d D:/arttest/3.执行替换命令retransform D:/arttest/demo/MathGame.class4.查看retransform -l以数值最大的为生效2、恢复热替换代码1、需要删除所有的替换entryretransfo

2022-03-11 17:39:20 2077

原创 k8s使用kubeadm安装(centos7)(v1.22.4)

0、安装docker参考:Install Docker Engine on CentOS | Docker Documentation1、配置yum源cat <<EOF > /etc/yum.repos.d/kubernetes.repo[kubernetes]name=Kubernetesbaseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/enabled=1gp

2021-11-28 21:23:42 1726

原创 SpringBoot使用H2嵌入式数据库

1、添加maven依赖<dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <!-- <version>1.4.200</version>--></dependency>2、添加配置信息到application.propertiesspring.datasource.driverCl

2021-10-30 23:15:08 3188

原创 java线程池ThreadPoolExecutor源码分析

public void execute(Runnable command) { if (command == null) throw new NullPointerException(); int c = ctl.get(); //获取workerCount+runState if (workerCountOf(c) < corePoolSize) { //当前线程小于核心线程数 if (addWorker(command, true)) //.

2021-04-28 10:39:08 175

原创 JAVA自带的各种Queue

1、LinkedList有人可能会问,这货怎么还是个Queue?实际上LinkedList不仅实现了List,还实现了Deque,而Deque继承自Queue。public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, java.io.Serializable我们知道队列的特性,先进先

2021-02-26 15:22:10 571

原创 JAVA自带的各种List(基于JDK11)

1、ArrayList平常一直使用的List内部为数组结构,我们来看看里面有什么://默认构造扩容大小private static final int DEFAULT_CAPACITY = 10;//空实例private static final Object[] EMPTY_ELEMENTDATA = {};//区分上面那个(扩容大小和上面不同)private static final Object[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {};/

2021-02-25 11:40:54 1129 2

原创 JAVA中自带的各种Set(基于JDK11)

1、HashSetHashSet底层为HashMap实现,里面的方法也基本是调用HashMap的方法。内部用了一个固定的Object对象作为每个Key对应的Value:// Dummy value to associate with an Object in the backing Mapprivate static final Object PRESENT = new Object();public HashSet() { map = new HashMap<>();

2021-02-24 14:24:08 413 2

原创 JAVA自带的各种HashMap(基于JDK11)

1、HashMapHashMap的数据结构在JDK1.8以下是:(数组+链表)在JDK1.8时更新为(数组+链表+红黑树)为什么要做这种转变呢?原因是当链表长度过长时会查询的时间复杂度时O(n),而转换成红黑树后查询的时间复杂度为O(logn),提高了查询效率,那么什么时候由链表转化为红黑树呢?//树化阈值static final int TREEIFY_THRESHOLD = 8;//树化数组容量阈值static final int MIN_TREEIFY_CAPACI.

2021-02-23 15:49:26 766

原创 python基础知识要点

1、剔除字符串空白:开头xxx.lstrip() 结尾rstrip() 双端 strip()2、处理浮点数包含的小数位可能不确定: >>> 0.2 + 0.1 = 0.300000000000000043、将数值转换为字符串:str(xxx)4、在列表中插入元素 xxx.insert(index,value) 指定新元素的索引和值5、从列表中删除元素 del xx...

2019-09-22 10:45:59 158

原创 effective java

1.创建和销毁对象第1条 : 用静态工厂方法代替构造器静态工厂方法的一个优点是,不像构造方法,它们是有名字的。一个类只能有一个给定签名的构造方法。 程序员知道通过提供两个构造方法来解决这个限制,这两个构造方法的参数列表只有它们的参数类型的顺序不同。 这是一个非常糟糕的主意。 这样的 API 用户将永远不会记得哪个构造方法是哪个,最终会错误地调用。 阅读使用这些构造方法的代码的人只有在参...

2019-07-15 15:22:49 204

转载 Java核心技术第10版卷一重点内容

一个方法可以修改传递引用所对应的变量值,而不能修改传递值调用所对应的变量值。public class Test { public static void main(String[] args) { int a = 10; doSome(a); Syst...

2019-06-18 11:09:19 283

原创 java 线程 interrupt 相关

1.实例方法isInterrupted()该方法会调用isInterrupted(false)private native boolean isInterrupted(boolean ClearInterrupted);返回调用的线程是否被中断,不会改变线程的中断状态注意:如果线程被阻塞, 就无法检测中断状态。这是产生 InterruptedExceptioii 异常的地方...

2019-06-14 09:25:11 137

原创 java类初始化顺序及<init>()与<clinit>()的区别猜想

1.<init>()与<clinit>()的区别猜想根据《深入理解java虚拟机》对<clinit>()的定义为:在类加载的初始化阶段是执行类构造器<clinit>()方法的过程。<clinit>()方法是由编译器自动收集类中的所有类变量的赋值动作和静态语句块(static{})中的语句合并产生的,编译器收集语句的顺序是由语句...

2019-05-14 18:00:45 568

原创 docker构建spring-boot环境镜像

1.在当前路径添加jdk的解压缩包,和Dockerfile,内容如下FROM docker.io/centos:6.8MAINTAINER from CCADD jdk /usr/jdkENV JAVA_HOME /usr/jdkENV JRE_HOME /usr/jdk/jreENV PATH $PATH:$JAVA_HOME/bin:$JRE_HOME/binENV CL...

2019-04-28 11:28:17 217

原创 关于Java中==和equals的区别

基础信息1.Integer a = 1; 该方法调用public static Integer valueOf(int i) { if (i >= IntegerCache.low && i <= IntegerCache.high) return IntegerCache.cache[i + (-IntegerCache...

2019-04-25 17:52:41 128

原创 spring boot 自定义配置文件

@Configuration@PropertySources({ @PropertySource("classpath:redis.properties"), @PropertySource("classpath:apple.properties")})public class PropertyConfig {}使用:@Value("${apple.color...

2019-04-19 16:35:46 172

原创 spring 定义静态内部类的bean

<bean id="xx" class="com.example.Foo$Bar"></bean>其中Foo为主类,Bar为static class

2019-04-19 16:33:19 1481

原创 spring 事件监听

一、同步监听1、定义监听事件(改监听事件需要继承ApplicationEvent)public class EatAppleEvent extends ApplicationEvent{ private String eater; public EatAppleEvent(Object source,String eater) { super(sourc...

2019-04-19 15:34:18 241

原创 spring-boot定时任务

普通@Configuration@EnableSchedulingpublic class ScheTask { private Logger logger = LoggerFactory.getLogger(getClass()); @Scheduled(cron="0/10 * * * * *") public void task(){ logger.info("...

2019-04-15 16:23:16 308

原创 spring自定义限定注解

@Target({ ElementType.FIELD,ElementType.METHOD })@Retention(RetentionPolicy.RUNTIME)@Documented@Inherited@Qualifierpublic @interface LoadBalanced {}@Bean@LoadBalanced@Autowired@LoadBalanc...

2019-04-15 15:53:20 386

原创 spring之自定义解析配置类

spring 3.0使用PropertyPlaceholderConfigurer自定义的话,需要继承PropertyPlaceholderConfigurer并重写protected String resolvePlaceholder(String placeholder, Properties props) { return props.getProperty(place...

2019-04-15 15:28:47 361

原创 spring之bean生命周期

参考https://www.cnblogs.com/zrtqsk/p/3735273.html初始化阶段(执行顺序根据序号,紫色为源码调用函数)1.执行InstantiationAwareBeanPostProcessorAdapter的postProcessBeforeInstantiation(在目标bean实例化之前,返回的对象可能是代替目标bean的一个代理,能有效抑制目标bea...

2019-04-15 15:01:39 168

原创 spring-boot以war包方式运行

<packaging>war</packaging><!-- 以war包方式运行 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-...

2019-04-15 09:34:52 285

原创 spring-boot自定义配置文件类

@Bean@ConfigurationProperties("foo")public SysPro sysPro(){ return new SysPro();}或@Component@ConfigurationProperties("foo")public class SysPro { //添加需要的属性}或@EnableConfiguration...

2019-04-15 09:34:45 161

原创 spring-boot自定义健康检测器

1、spring-boot-starter-actuator2、@Componentpublic class RabbitMqHealthIndicator implements HealthIndicator{ @Override public Health health() { return Health.down().withDetail("Erro...

2019-04-15 09:33:55 233

原创 spring-boot自定义度量信息

1、spring-boot-starter-actuator2、@Autowiredprivate CounterService counterService; @RequestMapping("/random.do")public String test(){ counterService.increment("display.random.count"); r...

2019-04-15 09:32:31 441

原创 spring-boot-远程调试

打成jar包启动时java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=实际端口号 -jar **.jar普通web工程远程调试vi ./catalina.sh加上JPDA_OPTS='-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=...

2019-04-14 14:59:16 220

原创 spring-boot远程开发

以下为eclipse操作1、在远程机器上运行java -jar xxxxxxxxx.jar 需要配置(spring.devtools.remote.secret=xxx)2、右键工程,run configuration -> java application -> 新建3、Main class 中输入org.springframework.boot.devtools.Rem...

2019-04-14 14:54:58 234

原创 spring-boot条件装配

Bean条件装配当有DataSource类型的bean存在就装配@Bean@ConditionalOnBean(DataSource.class)public BeetlUtils getBeetlUtils(){ System.out.println("条件装配"); return new BeetlUtils();}当BeetlUtils类型的bean不...

2019-04-14 14:44:26 341

原创 spring公用错误处理控制器

package com.boot.controller;import java.io.PrintWriter;import java.io.StringWriter;import org.springframework.web.bind.annotation.ControllerAdvice;import org.springframework.web.bind.annotation...

2019-04-14 11:33:23 154

原创 spring-boot-发布自定义度量信息

1、 CounterService(inc,dec,reset)与GaugeService(submit更新)@RestControllerpublic class AppleCtrl { @Autowired private CounterService counterService; @Autowired private GaugeService ga...

2019-04-14 11:31:35 354

原创 spring-boot-devtools

1、引入<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional&...

2019-04-14 11:25:31 153

原创 Spring之Profile

1.注解模式在application.properties配置active (可以配置公用配置)这个是正常配置生效方式spring.profiles.active=test (可以添加多个,用逗号隔开)对应的配置文件为application-test.properties或@Configuration@Profile("test")@Profile("test","...

2019-04-14 11:19:31 250

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除