- 博客(15)
- 收藏
- 关注
原创 mysql 统计不同成绩阶段的人数
case when 用sum而不是countselect sum(case when score<60 then 1 else null end) bujige,sum(case when score>=60 and score<80 then 1 else null end) jige,sum(case when score>=80 then 1 el...
2018-07-23 22:09:20
5562
原创 UUID
UUIDUUID含义是通用唯一识别码 (Universally Unique Identifier),这是一个软件建构的标准,也是被开源软件基金会 (Open Software Foundation, OSF) 的组织在分布式计算环境 (Distributed Computing Environment, DCE) 领域的一部份。 UUID 的目的,是让分布式系统中的所有元素,都能有唯一...
2018-07-23 22:07:52
356
原创 Java API限流
令牌桶算法 http://blog.didispace.com/spring-boot-request-limit/ 对于令牌桶的代码实现,可以直接使用Guava包中的RateLimiter。public class TestRateLimiter {static RateLimiter limiter = RateLimiter.create(2.0) ;public static...
2018-07-23 22:06:15
409
原创 springBoot 2.0.3 actuator
management.endpoints.web.exposure.include 配置actuator 暴露的接入点,默认值为health和info,此时调用/refresh会返回404错误 现在的方法如下:management.endpoints.web.exposure.include=refresh,health,info 文档:https://docs.sprin...
2018-07-23 22:05:25
432
原创 rabbitmq安装 centos6.8
1:前期准备(erlang安装环境)yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC unixODBC-devel httpd python-simplejson 2:查看安装mq版本依赖的erlang版本http://www.rabbitmq.com/which...
2018-07-23 17:52:38
342
原创 ConcurrentHashMap和HashMap和HashTable
ConcurrentHashMap它包含了一个Segment数组,每个Segment包含一个HashEntity数组,加锁时候是加在Segment对象上构造函数: public ConcurrentHashMap() { this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_CONCURRENCY_LEV
2017-06-15 17:57:15
165
转载 ConcurrentLinkedQueue
ConcurrentLinkedQueue : 基于非阻塞算法和链表结构的线程安全队列非阻塞算法 (nonblocking algorithms)一个线程的失败或者挂起不应该影响其他线程的失败或挂起的算法。实现无锁(lock-free)的非阻塞算法有多种实现方法,其中 CAS(比较与交换,Compare and swap) 是一种有名的无锁算法。
2017-06-14 16:01:19
252
原创 Collections.synchronizedCollection
对与集合的同步,方法之一是使用 Collections :如以下方法:Collections.synchronizedCollection(Collection c)返回的是一个 Collection 对象的装饰者对象 ,这个装饰者对象的所有方法都是同步的public static Collection synchronizedCollection(Collection c)
2017-06-14 09:20:23
2450
原创 ThreadLocal
线程安全大概分为两类 : 一类是多个线程共享一个变量 访问时候加锁,属于以时间换空间 一类是每个线程有自己的变量(不需要共享),不需要加锁 速度更快 但是 耗费内存 (为每个线程new了一个变量) 而ThreadLocal就属于后者主要方法:set(T t) public void set(T value) { Thread t = Thread
2017-06-13 17:11:16
224
原创 SimpleDateFormat的套路
由于SimpleDateFormat是一个非线程安全类(由于它的protected Calendar calendar;属性是非线程安全的),本来想测试下ThreadLocal下的线程安全SimpleDateFormat,结果输出的 simpleDateFormat 都是一样的public class TestLocal { ThreadLocal threadLocal = new
2017-06-13 16:24:23
297
原创 ThreadPoolExecutor
ThreadPoolExecutor(基于jdk1.6 主要看线程执行流程,不关注线程池状态等):主要属性:BlockingQueue workQueue:同步任务队列ReentrantLock mainLock:同步锁 用于addIfUnderCorePoolSize等方法中 HashSet workers:执行任务的worker队列volatile int
2017-06-13 11:09:19
203
转载 Git
原文地址:http://www.jb51.net/article/55438.htmGit介绍分布式 : Git版本控制系统是一个分布式的系统, 是用来保存工程源代码历史状态的命令行工具;保存点 : Git的保存点可以追踪源码中的文件, 并能得到某一个时间点上的整个工程项目额状态; 可以在该保存点将多人提交的源码合并, 也可以会退到某一个保存点上;Git离线操作性 :Git
2015-01-04 14:12:08
373
原创 java int转换
只有比int长度大的可以自动转换为intpackage primary_data_type;public class SwitchTest {public static void main(String[] args){ byte b=9; //8 bitshort a=1;//16 bitint sitcInt=19;//32 bitlong
2015-01-01 10:56:25
430
原创 Mysql
关键字:proceduredrop procedure if exists pp;/*如果存在存储过程pp则删除pp*/delimiter // /**设置以//为sql语句结尾*/1:不带参数的存储过程create procedure pp()beginselect count(*) from t_com_dim_date;end//
2014-12-24 16:28:24
315
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人