// Jakarta Commons Loggingprivate static final Log log = LogFactory.getLog(MyClass.class);The above code also shows another good practice, which is to pass the Class object to the getLog() method, instead of a string. Why the java.util.logging.Logger…
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLists and ArrayLists (and Vectors) (Page last updated May 2001, Added 2001-06-18, Author Jack Shirazi, Publisher OnJava). Tips: ArrayList is faster than…
5.1. Classes, Superclasses, and SubclassesLet's return to the Employee class that we discussed in the previous chapter. Suppose (alas) you work for a company at which managers are treated differently from other employees. Managers are, of course, jus…
一.    关于Log4J 2015年5月,Apache宣布Log4J 1.x 停止更新.最新版为1.2.17. 如今,Log4J 2.x已更新至2.7. 官方网址:http://logging.apache.org/log4j/2.x/ 二.    Log4J能做什么? 1.    将信息送到控制台,文件,GUI组件等. 2.    控制每条信息的输出格式. 3.    将信息分类,定义信息级别,细致地控制日志的输出. 三.    Log4J2的安装 1.    去官网下载log4j2,解压…
原始版本 public static Object getInstance() { if (instance != null) { return instance; } instance = new Object(); return instance; } 不足:没有考虑多线程 版本1: public static synchronized Object getInstance() { if (instance != null) { return instance; } instance = n…
1.properties配置文件的信息 fcsimage_path=C://FCSImage 2.Java代码 public final class Config { private static final Object lock = new Object(); private static volatile Properties config; private Config(){} private static Properties getInstance(){ if (config ==…
1.spring boot日志概述 spring boot使用Commons Logging作为内部的日志系统,并且给Java Util Logging,Log4J2以及Logback都提供了默认的配置.如果使用了spring boot的Starters,那么默认会使用Logback用于记录日志. 2.spring boot日志默认配置 我们启动一个空的spring-boot项目看一下控制台的日志 控制台的默认配置 logging.pattern.console=%clr(%d{${LOG_DA…
原文:http://www.infoq.com/cn/articles/double-checked-locking-with-delay-initialization#theCommentsSection 有很多知识点可以再延伸.消化一下. 双重锁定检查(Double Check Lock)这个词看上去有些摸不着头脑.但是如果你有兴趣看一下java框架的话,你可能会遇到这种代码(没错,就是我看到过).没事,先来看一下下面的这个例子. 线程不安全的单例模式 线程不安全的单例模式: package…
在以前的文章中介绍了通过 [<实战PMD>](https://zhuanlan.zhihu.com/p/105585075).[<实战Checkstyle>](https://zhuanlan.zhihu.com/p/105583516)在代码级守护我们的代码,比通过[<实战Jacoco>](https://zhuanlan.zhihu.com/p/105581725)来了解当前项目的测试覆盖情况.通过得到数据了解我们的项目质量,进行定向的改进. 使用这些简单方面的自动…
March 16, 2016 Problem statement:Given a 2D array (matrix) named M, print all items of M in a spiral order, clockwise.For example: M  =  1   2   3   4   5       6   7   8   9  10      11  12  13  14  15      16  17  18  19  20 The clockwise spiral pr…