Skip to content

Instantly share code, notes, and snippets.

arganzheng arganzheng

Block or report user

Report or block arganzheng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View setenv.sh
# determine base directory; preserve where you're running from
#echo "Path to $(basename $0) is $(readlink -f $0)"
realpath=$(readlink -f "$0")
filepath=$(dirname "$realpath")
basedir=${filepath%/*}
LOG_DIR=${basedir}/logs
mkdir -p ${LOG_DIR}
GC_LOG_DIR=${basedir}/logs/gc
mkdir -p ${GC_LOG_DIR}
@arganzheng
arganzheng / PoolingHttpClient
Created Jun 18, 2015
An HttpClient with PoolingHttpClientConnectionManager
View PoolingHttpClient
package org.opentsdb.client;
import static com.google.common.base.Preconditions.checkArgument;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HeaderElement;
import org.apache.http.HeaderElementIterator;
View 优雅的builder.md

优雅的Builder模式

package com.baidu.global.mobile.hao123.nantianmen.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
View protocal-buffer-study.md
title layout
protocal-buffers学习笔记
post

产生背景(Why Google Invent PB)

在官方文档上 A bit of history 介绍了PB的产生原因。

View 鹏城放生组放生公告.md

鹏城放生组2013年12月1号(星期日)放生公告

放生时间: 2013年12月1号(星期日)上午9点30分举行放生。 集合地点:当天9点正在深圳市大鹏新区大鹏银滩大道金水湾渡假村大门口标有“金水湾”字样的指示牌处集合。 开车前往的师兄导航大鹏银滩大道金水湾渡假村;乘坐公交车的师兄可选择:一是坐E11.H92或833.818到大鹏站下车后转乘b756到鹏城挢站下车,反方向步行至红绿灯左拐入银滩大道再走10分钟到金水湾度假村;二是坐E11.H92或833.818到大鹏站下车后,再在大鹏二站坐928到金水湾度假村站下车(928公交相隔20分钟一班,上车时请吩咐驾驶员到站让下。 欢迎随喜参加,功德无量。 放生随喜帐号: 中国银行,账号6216612000005457219,户名:欧阳权

@arganzheng
arganzheng / JavaNioStudy.java
Created Nov 22, 2013
Java NIO study Selector Channel select
View JavaNioStudy.java
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
View 如何提高消息系统吞吐量.md

如何提高消息系统吞吐量

  1. should not block while processing a message
  2. prefer immutable message
  3. batch and piggy(捎带)
  4. avoid polling, try callback notify
  5. cache,但是要注意数据同步更新问题
View builder.md

优雅的builder模式

public class NetworkUpdatesService{

	public void getNetworkUpdatesSummary(){
		UpdateQueryCriteria query = UpdateQueryCriteria.createDefaultCriteria()
				.setMemberID(2)
				.setRequestdTypes(NetworkUpdateType.CONNECTION)
				.setCutoffDate(...)
View 设置线程未捕获异常回调函数.md

import java.lang.Thread.UncaughtExceptionHandler; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory;

/**

  • @ClassName: ExceptionThread
  • @Description: TODO(这里用一句话描述这个类的作用)
  • @date 2013-10-10 下午12:04:23 */
You can’t perform that action at this time.