Skip to content

Instantly share code, notes, and snippets.

🇨🇳

wanglichao 0532

🇨🇳
View GitHub Profile
@0532
0532 / channel_v3.json
Created Mar 26, 2019
解决sublime text 3使用Install Package时出现There are no packages available for installation问题
View channel_v3.json
This file has been truncated, but you can view the full file.
View ThreadPoolManager.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Queue;
import java.util.concurrent.*;
/**
* 线程池管理
*/
@0532
0532 / FingerPrintFeignconfig.java
Created Jan 9, 2019
feign请求copy 请求头,使用方法@FeignClient(url = "${feign.url.internal.securityService}", name = "deviceFingerPrintFeign" , configuration = FingerPrintFeignconfig.class)
View FingerPrintFeignconfig.java
@Configuration
public class FingerPrintFeignconfig implements RequestInterceptor {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void apply(RequestTemplate template) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder
.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
@0532
0532 / show-busy-java-threads.sh
Created Dec 21, 2018
显示当期服务器占用线程数 sh show-busy-java-threads.sh -p PID
View show-busy-java-threads.sh
#!/bin/bash
# @Function
# Find out the highest cpu consumed threads of java, and print the stack of these threads.
#
# @Usage
# $ ./show-busy-java-threads
#
# @online-doc https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads
# @author Jerry Lee (oldratlee at gmail dot com)
# @author superhj1987 (superhj1987 at 126 dot com)
View AsyncAlertService.java
package com.doraemoney.wk.quotecheckplatform.service.support;
import com.alibaba.fastjson.JSONObject;
import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.DefaultAsyncHttpClient;
import org.asynchttpclient.DefaultAsyncHttpClientConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
@0532
0532 / ForkJoin.java
Created Oct 26, 2018
forkjoin多线程执行任务
View ForkJoin.java
package com.doraemoney.wk.quotecheckplatform.util;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.RecursiveAction;
import java.util.concurrent.TimeUnit;
/**
* created by wanglichao@163.com on 2018/10/26.
*/
public class PrintTask extends RecursiveAction{
@0532
0532 / jvm-tomcat.con
Created Aug 16, 2018
jvm tomcat 服务器配置
View jvm-tomcat.con
安装软件
jdk
jdk版本: jdk-8u171-linux-x64.tar.gz
#安装路径:
tar -zxf jdk-8u171-linux-x64.tar.gz
ln -s /app/java/jdk1.8.0_171 /app/java/default
#设置环境变量
vim ~/.bash_profile
@0532
0532 / git.alias
Last active Aug 15, 2018
git 命令常用别名,配置在.gitconfig文件下
View git.alias
[alias]
s = status
st = status
sb = status -s -b
#############
d = diff
di = diff
dc = diff --cached
dk = diff --check
dck = diff --cached --check
@0532
0532 / RecursiveTaskTest
Created May 26, 2017
fork/join多线程使用
View RecursiveTaskTest
package com.doraemoney.test.own;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.RecursiveTask;
import com.doraemoney.core.utils.ThreadPoolUtils;
/**
* Created By WangLichao On 2017年5月26日.
View ListableFutureTest
/**
* Created By WangLichao On 2016年12月26日.
*/
public class ListableFutureTest {
private ExecutorService executor = Executors.newFixedThreadPool(1);
private ListeningExecutorService service = MoreExecutors.listeningDecorator(executor);
public static void main(String[] args){
You can’t perform that action at this time.