HA

Java

1. 定位控制台中的未知log, 并抑制输出 历史遗留项目中依赖很多, 有时会有很多不同的日志框架被整合进来, 就有可能会遇到某些依赖包中的日志输出没有
测试方法 @BeforeEach 备份表 执行方法 @AfterEach 从备份表恢复数据并删除备份表 示例代码: { @Autowired private JdbcTemplate jdbcTemplate; @BeforeEach public void before() { // 备份表 String today = LocalDate.now().format(DateTimeFormatter.ofPattern("uuMMdd")); template.execute(String.format("create table test_table_%s as select * from test_table", today)); } @AfterEach public void after() { String today = LocalDate.now().format(DateTimeFormatter.ofPattern("uuMMdd")); template.execute(String.format("insert
问题描述 一台服务器出现OOM(为本应用分配了4G内存),挂掉了 java.lang.OutOfMemoryError: GC overhead limit exceeded 问题排查 拿到dump文件,使用jvisualvm打开查看后,发现下面
双花括号初始化 有时候写测试代码,需要新建hashmap或者list并赋值的时候,可以用双花括号初始化简化代码,但是据说有内存泄漏的风险,所以
问题描述 有一个抽数据库数据写入文件的定时任务,发现有些文件数据不全,导入一半就结束了。 实现说明 service是共用的同一个,在Quartz类
// use spring FileSystemUtils.deleteRecursively(file); // java 8 Files.walk(path) .sorted(Comparator.reverseOrder()) .map(Path::toFile) .forEach(File::delete); reference Delete a Directory Recursively in Java | Baeldung
nohup java -jar /web/server.jar > log.log 2>&1 & reference Run java jar file on a server as background process Launch springboot project in the background on Linux 2>&1到底是什么意思?
Java 将对象序列化为字符串 读取字符串反序列化为对象 import java.io.Serializable; class test { public static String object2String(Object obj) { String objBody = null; ByteArrayOutputStream baops = null; ObjectOutputStream oos = null; try { baops = new ByteArrayOutputStream(); oos = new ObjectOutputStream(baops); oos.writeObject(obj); byte[] bytes = baops.toByteArray(); objBody = Base64.encodeToString(bytes, Base64.DEFAULT); } catch(IOException e) { Log.e(tag,
java 函数返回多个函数值/引用類型認識 開宗明義,Java中函數的參數傳遞都是值傳遞,不存在引用傳遞。基本數據類型傳遞的是本身的值,而引用類型(對