This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Foo project | |
@SpringBootApplication | |
public class FooApplication { | |
public static void main(String[] args) { | |
SpringApplication.run(FooApplication.class, args); | |
} | |
@Bean | |
public Mapper fooDozerBeanMapper() { | |
DozerBeanMapper mapper = BeanMapper.getDozerBeanMapper(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 验证并发情况下的自定义订单流水号生成器是否会有重复 | |
// 订单流水号生成器 | |
public static String getOrderNo(){ | |
String orderNo = ""; | |
String date = new SimpleDateFormat("yyMMddHHmmss").format(new Date()); | |
Integer math = new Random().nextInt(1000); | |
orderNo = date+""+math; | |
return orderNo; | |
} | |
// 验证代码 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
[ | |
{ | |
"category": "tag_foo", | |
"tagPrice": [ | |
{ | |
"activeTagDictId": 370, | |
"activePrice": 39 | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//如何模拟异常堆栈占用内存过多导致频繁FulGC | |
//java.lang.StackTraceElement数据已经占用了85M | |
//目前的代码不能很好的重现该问题 | |
package com.hlj.test; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.CountDownLatch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#write by wozi | |
#!/bin/bash | |
HOSTS=( | |
'root@101.251.1.1 7711' | |
'root@172.16.1.1 7711 password' | |
) | |
function show() { | |
echo 'ALL HOSTS' | |
echo '===============================' | |
for ((i=0; i<${#HOSTS[*]}; i++)); do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 验证并发update mysql数据库记录 | |
* @param args | |
* @throws SQLException | |
* @throws IOException | |
* @throws InterruptedException | |
*/ | |
public static void main(String[] args) throws SQLException, IOException, InterruptedException { | |
String url = "jdbc:mysql://localhost:3306/test"; | |
String user = "root"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Map; | |
import java.util.Map.Entry; | |
import java.util.Optional; | |
import java.util.Random; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.stream.Collectors; | |
/** | |
* <pre> | |
* 转盘抽奖算法demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************* | |
* Copyright (c) 2005, 2014 springside.github.io | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
*******************************************************************************/ | |
package org.springside.modules.nosql.redis; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Set; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.zhugw; | |
import org.apache.commons.lang3.RandomStringUtils; | |
import java.sql.*; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.helijia.lottery.service; | |
import com.helijia.common.api.model.ApiException; | |
import com.helijia.lottery.dao.mapper.TestMapper; | |
import org.apache.commons.lang.RandomStringUtils; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
import org.springframework.stereotype.Service; | |
import org.springframework.transaction.TransactionDefinition; | |
import org.springframework.transaction.TransactionStatus; |
OlderNewer