`
wkwukong
  • 浏览: 9065 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表

解决GC问题

1、top查看CPU占用最高的PID 2、ps -mp 9825 -o THREAD,tid,time | sort -rn 9925是步骤1通过top命令查看到得PID 3、printf "%x\n" 9929 4、jstack 9825|grep 26c9 -A 100
最近项目中用到了GUAVA的eventbus来做异步操作,感觉很顺手,这里写了个小demo,作为备忘:(引入guava 18.0版本)   1.AppEventBus类:用来注册,执行和卸载事件,内部实例化了一个AsyncEventBus类,用线程池开了四个线程。 2.StringMessageEvent:事件类。 3.StringMessageListener类:监听者,会实例化一个AppEventBus和一个具体业务处理类StringMsgHandler。当监听到StringMessageEvent事件的时候,会执行 带有 @Subscribe 注解的方法。 4.
话不多说,直接上代码(本算法转载自“并发编程网 http://ifeve.com”)。   public class CycleAtomicInteger { private final static long PARK_TIME = 1000L * 1000; private AtomicInteger counter = new AtomicInteger(0); private int range; public CycleAtomicInteger(int range) { if (range < 2) throw new I ...
window.location.href 进行网页跳转,如果带前缀http://(如http://www.baidu.com) , 则跳转到新的网页。如果不带前缀,则当成子路径进行跳转。   window.location.href = "http://www.baidu.com" :跳转到百度的页面 window.location.href = "www.baidu.com" :跳转到    当前路径/www.baidu.com ,结果是找不到网页
代码: public class JVMTest {    public static void main(String[] args) {        String bootPath = System.getProperty("sun.boot.class.path");        String extPath = System.getProperty("java.ext.dirs");        String userPath = System.getProperty(" ...
抓取Craigslist网站的爬虫,多线程,可以做成自动抓取。
      庞果网上的一道题目:打印N个字符的全排列,百度了一下。百度百科介绍如下(http://baike.baidu.com/view/1710135.htm),根据百度百科的提示,自己实现了一下,以下为源代码: public class Combine {    public static void combine(Integer ...
方法一:   1. 带有父节点信息的节点:   public class FlatNode {    private Integer path;    private String name;    private Integer parent;    public Integer getPath() {        return path;    }    public void setPath(Integer path) {        this.path = path;    }    public Integer getParent() {        return p ...
Global site tag (gtag.js) - Google Analytics