Skip to content

Instantly share code, notes, and snippets.

View bohrqiu's full-sized avatar

bohr bohrqiu

View GitHub Profile
@bohrqiu
bohrqiu / gist:5503811
Created May 2, 2013 17:24
druid slf4j日志集成
diff --git a/src/main/java/com/alibaba/druid/support/logging/LogFactory.java b/src/main/java/com/alibaba/druid/support/logging/LogFactory.java
index dbdc21a..fe6f467 100644
--- a/src/main/java/com/alibaba/druid/support/logging/LogFactory.java
+++ b/src/main/java/com/alibaba/druid/support/logging/LogFactory.java
@@ -23,9 +23,7 @@
private static Constructor logConstructor;
static {
- // TODO add slf4j logging
-
@bohrqiu
bohrqiu / dump.sh
Last active December 22, 2015 19:19
java进程关闭时收集dump
JAVA_HOME=/usr/lib/jvm/java-7-sun
OUTPUT_HOME=/var/log/webapps/cs/
DEPLOY_HOME=/usr/local/apache-tomcat-7.0.26-cs
HOST_NAME=`hostname`
DUMP_PIDS=`ps --no-heading -C java -f --width 1000 | grep "$DEPLOY_HOME" |awk '{print $2}'`
if [ -z "$DUMP_PIDS" ]; then
echo "The server $HOST_NAME is not started!"
exit 1;
fi
@bohrqiu
bohrqiu / jetty
Last active December 31, 2015 19:49
java web项目测试时启动jetty
1.在项目父pom中添加build插件:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.1.0.v20131115</version>
<configuration>
<reload>automatic</reload>
</configuration>
</plugin>
@bohrqiu
bohrqiu / maven-package-verson
Last active December 31, 2015 19:58
maven打包时,自动生成静态资源版本号
1.在web项目pom里面添加build插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<includes>
@bohrqiu
bohrqiu / cxf_client_timeout_config
Last active January 1, 2016 23:19
cxf client timeout configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:osgi="http://www.springframework.org/schema/osgi"
xmlns:p="http://www.springframework.org/schema/p" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd"
@bohrqiu
bohrqiu / RequestBindingTest.java
Last active November 22, 2016 05:51
http request 转换为对象
import com.google.common.collect.Maps;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.core.convert.converter.Converter;
@bohrqiu
bohrqiu / Copier.java
Last active April 24, 2017 02:06
对象属性复制工具类,采用javassit生成源代码实现属性复制.并能实现包装类型和基础类型之间的转换
package bohr.javassist;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.CtNewMethod;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.beans.BeanInfo;
@bohrqiu
bohrqiu / gist:817669f38261104c31d8
Created August 21, 2014 06:55
tomcat-maven-plugin config ssl
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>keytool-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<phase>generate-resources</phase>
<id>clean</id>
@bohrqiu
bohrqiu / monitor_create_thread
Last active August 29, 2015 14:05
btrace script monitor create new thread
import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;
@BTrace
public class TracingScript {
public static int count = 0;
@OnMethod(clazz = "java.lang.Thread", method = "start")
public static void onNewThread() {
@bohrqiu
bohrqiu / gist:1f32d3575e89ec09e8d5
Last active August 29, 2015 14:05
maven remote debug
MAVEN_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8765'

transport

这里通常使用套接字传输。但是在 Windows 平台上也可以使用共享内存传输。

server