自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 统一异常处理

统一项目数据格式,统一异常管理便于更好的定位项目问题。 由于自我实现有项目业务原因,把主要的接口与思路分享,可自由实现自我适合的业务异常链路。 核心思路:类似于filter责任链处理方式。 chain :管理handler执行链路 handler:处理特定异常的处理器(我使用自定义处理标记处理器);abs...

2018-03-04 22:30:35 387

原创 springboot-mybatis—多数据源

工作老系统添加新的功能 需要调用其他数据库的资源,应用多数据源,老大只给一晚上解决,哎,总算是磨出来(看了很多好的博客),我也记录一篇,也给后人方便。 原理简单说明,详细请看代码分析。 1. 配置多个数据源 =》 每个数据源一个key。 2. 将多个数据源注入到DynmicDataSource(自己定义,必须实现AbstractRoutingDataSource)。 3. 设置默认数据

2017-04-18 23:46:28 2897 2

原创 leetcode-month3-week10

Two Sum II Input array is sortedpackage ygy.test.week10;import java.util.HashMap;import java.util.Map;/** * Created by guoyao on 2017/11/4. */public class TwoSumIIInputarrayissorted { public int

2017-11-05 16:42:49 279

原创 concurrent-7-AQS-CountDownLatch,CyclicBarrier

CountDownLatchCountDownLatch#tryAcquireShared protected int tryAcquireShared(int acquires) { return (getState() == 0) ? 1 : -1; //获取状态是不是达到条件 }CountDownLatch#tryReleaseSharedpro

2017-10-29 19:26:26 274

原创 leetcode-month2-week9

Best Time to Buy and Sell Stock IIpackage ygy.test.week9;/** * Created by guoyao on 2017/10/27. */public class BestTimetoBuyandSellStockII { public static void main(String[] args) { int[]

2017-10-29 15:29:24 252

原创 concurrent-6-AQS-Semaphore

Semaphore#acquire public void acquire() throws InterruptedException { sync.acquireSharedInterruptibly(1); //请求资源 }AQS#acquireSharedInterruptibly public final void acquireSharedInterruptib

2017-10-28 22:57:43 261

原创 concurrent-5-AQS-ReentrantReadWriteLock

ReentrantReadWriteLock#WriteLock#lockpublic void lock() { sync.acquire(1); //尝试获取资源 }ReentrantReadWriteLock#tryAcquire protected final boolean tryAcquire(int acquires) {

2017-10-27 00:06:31 184

原创 leetcode-month2-week8

Path Sumpackage ygy.test.week8;import java.util.LinkedList;import java.util.Queue;/** * Created by guoyao on 2017/10/20. */public class PathSum { public static void main(String[] args) {

2017-10-22 17:41:52 181

原创 concurrent-5-AQS-Condition

等待await public final void await() throws InterruptedException { if (Thread.interrupted()) //响应中断 throw new InterruptedException(); Node node = addConditionWaite

2017-10-21 20:04:55 200

原创 concurrent-4-AQS-ReentrantLock-Lock

AbstractQueuedSynchronizer

2017-10-19 00:34:17 150

原创 leetcode-month2-week7

Binary Tree Level Order Traversal IIpackage ygy.test.week7;import java.util.*;/** * Created by guoyao on 2017/10/13. */public class BinaryTreeLevelOrderTraversalII { public static void main(Strin

2017-10-15 14:51:07 208

原创 拓扑排序-Dijkstra算法

package com.ygy.test.sort;import lombok.Getter; import lombok.Setter; import org.springframework.util.CollectionUtils;import java.util.*;/** * Created by guoyao on 2017/10/11. *///拓扑排序 public cl

2017-10-13 16:18:26 698

原创 拓扑排序-bfs-广度优先搜索

breadth-first searchpackage com.ygy.test.sort;import lombok.Getter;import lombok.Setter;import org.springframework.util.CollectionUtils;import java.util.*;/** * Created by guoyao on 2017/10/11. *//

2017-10-12 16:49:15 775

原创 Java Perfomance

cpu使用率监控vmstat 指令#所有虚拟处理器的总cpu使用率统计mpstat#每个虚拟处理器的cpu使用率,判断是否均匀使用cputop#包含cpu使用率及进程统计数据和内存使用率

2017-10-11 17:24:58 187

原创 拓扑排序-简单实现

package com.ygy.test.sort;import lombok.Getter;import lombok.Setter;import org.springframework.util.CollectionUtils;import java.util.*;/** * Created by guoyao on 2017/10/11. *///简单的拓扑排序public clas

2017-10-11 16:52:49 229

原创 leetcode-month2-week6

Merge Sorted Arraypackage ygy.test.week6;/** * Created by guoyao on 2017/10/7. */public class MergeSortedArray { public static void main(String[] args) { } //从大到小的倒序排序 public static vo

2017-10-08 14:04:54 158

原创 PriorityQueue-数组(二叉堆)

field //默认初始化大小 private static final int DEFAULT_INITIAL_CAPACITY = 11; //队列内置为数组,实际为数据结构中的二叉堆 transient Object[] queue; // non-private to simplify nested class access //容量大小

2017-10-03 19:59:55 696

原创 leetcode-month2-week5

Add Binarypackage ygy.test.week5;/** * Created by guoyao on 2017/10/1. */public class AddBinary { public static void main(String[] args) { System.out.println(addBinary("1","111")); }

2017-10-02 22:45:55 177

原创 leetcode-month1-week4

Count and Saypackage ygy.test.week4;/** * Created by guoyao on 2017/9/24. */public class CountandSay { public static void main(String[] args) { System.out.println(countAndSay(4)); }

2017-09-24 18:53:56 195

原创 HashMap-数组+链表集合

#

2017-09-22 10:34:14 808

原创 leetcode-month1-week3

Valid Parenthesespackage ygy.test.week3;import java.util.Stack;/** * Created by guoyao on 2017/9/15. */public class ValidParentheses { public static void main(String[] agrs) { System.out.p

2017-09-20 15:30:15 182

原创 leetcode-month1-week2

Longest Copackage ygy.test.week2;/** * Created by guoyao on 2017/9/10. */public class LongestCommonPrefix { public static void main(String[] args) { String [] arrs = {"abc","abcd","abcde",

2017-09-20 15:26:38 162

原创 leetcode-month1-week1

Add Two Numberspackage ygy.test.week1;/** * Created by guoyao on 2017/9/3. */public class AddTwoNumbers { /** * You are given two non-empty linked lists representing two non-negative integer

2017-09-20 15:22:42 176

原创 springboot-cloud-8-ribbon-source

LoadBalancerAutoConfiguration 定制个性化的restTemplate//定制个性化 restTemplate @Bean public SmartInitializingSingleton loadBalancedRestTemplateInitializer( final List customizers) {

2017-09-15 10:21:24 507

原创 springboot-cloud-7-eureka-source

pre start 开始EnableEurekaClient注解@Target({ElementType.TYPE})@Retention(RetentionPolicy.RUNTIME)@Documented@Inherited// 导入EnableDiscoveryClientImportSelector 配置@Import({EnableDiscoveryClien

2017-09-14 15:55:24 231

原创 zookeeper-curator-interprocessmutex

constructorInterProcessMutex(CuratorFramework client, String path, String lockName, int maxLeases, LockInternalsDriver driver) { basePath = PathUtils.validatePath(path); intern

2017-09-08 17:45:49 1278

原创 zookeeper-curator-leaderSelector

NodeCache constructor/** 初始化参数 * @param client curztor client 客户端 * @param path the full path to the node to cache 节点路径 * @param dataIsCompressed if true, data in the path i

2017-09-04 23:39:52 908

原创 zookeeper-curator

Curator_Startpackage test.ygy.curator;import org.apache.curator.RetryPolicy;import org.apache.curator.framework.CuratorFramework;import org.apache.curator.framework.CuratorFrameworkFactory;im

2017-08-31 17:33:29 352

原创 zookeeper-crud

//安装zookeeper 3台vm本地ip 130 132 133[root@localhost ~]# mkdir -p /usr/local/software[root@localhost ~]# mv zookeeper-3.4.5.tar.gz /usr/local/software/[root@localhost ~]# cd /usr/local/software/[ro

2017-08-25 23:31:02 456

原创 springboot-cloud-6-config

configapplication.propertiesserver.port=8005spring.application.name=config-server###git仓库地址spring.cloud.config.server.git.uri= https://github.com/github-ygy/spring_cloud_test####git 相对目录地址

2017-08-19 18:07:01 505

原创 springboot-cloud-5-zuul

zuulapplication.propertiesserver.port= 8004spring.application.name=zuul-master###配置zuul路由zuul.routes.service-a.path= /service-a/**zuul.routes.service-a.serviceId = clientzuul.routes..servic

2017-08-18 17:19:35 587

原创 springboot-cloud-4-feign

feignapplication.propertiesspring.application.name = feign-masterserver.port=8003eureka.client.serviceUrl.defaultZone=http://pear1:9998/eurekaapplication@SpringBootApplication@EnableD

2017-08-14 23:46:34 220

原创 springboot-cloud-3-Hystrix

Hystrix

2017-08-13 22:32:45 366

原创 springboot-cloud-2-ribbon

github地址:https://github.com/github-ygy/spring_cloud_test.gitribbon-consumer 依据springboot-cloud-2-eureka 快速启动ribbon消费 前提: eureka-server : 注册中心分片1(也是提供者),注册自己的helloworld服务 eureka-

2017-08-09 21:16:10 699

原创 springboot-cloud-1-eureka

github地址:https://github.com/github-ygy/spring_cloud_testeureka-serverpomproject xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLo

2017-08-08 10:56:18 289

原创 mq-4-rmq安装

配置rocketmq配置hosts[root@iz2ze38kyanwmst1qj2lojz ~]# vim /etc/hosts//内容###host配置 rocketmq集群47.94.200.13 rocketmq-nameserver1 47.94.200.13 rocketmq-master1120.77.145.229 rocketmq-nameserver21

2017-08-07 11:04:54 368

原创 mq-3-amq连接

配置静态连接 //vim activemq.xml 添加 <!-- conf for statclly network --> <networkConnectors> <networkConnector name="local network" uri="sta

2017-07-30 22:21:23 846

原创 mq-2-多broker配置

桥接配置 1.cp conf目录(新broker启动配置目录) 2.修改activemq.xml a.brokerName 互相不能重复 b.数据存放的文件名称不能重复 c.所有涉及的transportConnector的端口,都需要不一样 3.修改jetty.xml中的端口(互不相同) 4、cp activemq目录

2017-07-28 15:13:51 449

原创 io-5-netty-工作原理

ServerBootStrap 服务启动辅助类,无参构造,采用builder模式(返回本对象构造参数)。group (初始化线程组)//加入线程组 public ServerBootstrap group(EventLoopGroup parentGroup, EventLoopGroup childGroup) { super.group(parentGr

2017-07-25 23:27:03 344

原创 io-4-netty-入门程序

netty

2017-07-18 22:37:19 208

空空如也

空空如也

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

TA关注的人

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