原创 如何減少線程上下文切換 原
線程的上下文切換分爲讓步式上下文切換和搶佔式上下文切換。前者是指執行線程主動釋放CPU,與鎖競爭嚴重程度成正比,可通過減少鎖競爭來避免;後者是指線程因分配的時間片用盡而被迫放棄CPU或者被其他優先級更高的線程所搶佔,一般由於線程數大於CPU
原创 是maven項目在指定JDK版本下編譯和運行 原
Sometimes when you may need to compile a certain project to a different version than what you are currently using. The j
原创 Databus架構分析與初步實踐(for mysql) 轉
目前關於databus的相關資料較少,特別是針對mysql的文檔尤爲稀少。本篇文章中介紹了databus相關組件及實現原理,初步實現了databus對mysql數據庫的數據抓取,希望對後續使用者能提供一定的參考作用。 1. 簡介 Data
原创 Logging Servlet for changing Log Level at Runtime - Log4j2 原
import java.io.IOException; import java.io.PrintWriter; import java.net.URLEncoder; import java.util.ArrayList; import j
原创 Mybatis 源碼學習 轉
調用順序鏈 解析xml配置 Reader reader = Resources.getResourceAsReader("mybatis-config.xml"); sqlSessionFactory = new S
原创 Spring Globle Transaction VS Local Transaction . 原
Actually there are plenty of resources answering your first two questions, for example Spring Documentation explains wha
原创 ThreadPoolExecutor的submit方法以及FutureTask源碼學習 原
ThreadPoolExecutor#Submit: public <T> Future<T> submit(Callable<T> task) { if (task == null) throw new NullPoi
原创 how to find the tomcat version info on linux 原
Go to tomcat/lib folder . java -cp catalina.jar org.apache.catalina.util.ServerInfo
原创 GIT 原
git branch git checkout [branchname] git checkout -b dev == 1. git branch dev 2. git checkout dev git tag git ta
原创 Log4j2 Analysis 原
Log4j2 improvement compare with Log4j : AsyncLogger : Implemented by LMAX Disruptor technology (a lock-fre
原创 thread join 原
Thread.join 方法 可以理解爲將一個thread的task 加入到另一個thread中執行 。 例如:有兩個thread t1 , t2 . 如果 在t2中調t1.join() 就會將t1的task加入到t2中執行。 而t2
原创 你可能不知道的 5 個強大的 HTML5 API 轉
1. 全屏API(Fullscreen API) 該API允許開發者以編程方式將Web應用程序全屏運行,使Web應用程序更像本地應用程序。 Javascript代碼 // 找到適合瀏覽器的全屏方法 function l
原创 分佈式鎖的幾種實現方式~ 轉
目前幾乎很多大型網站及應用都是分佈式部署的,分佈式場景中的數據一致性問題一直是一個比較重要的話題。分佈式的CAP理論告訴我們“任何一個分佈式系統都無法同時滿足一致性(Consistency)、可用性(Availability)和分區容錯性(
原创 why logging api better than system.out.println 原
The first and foremost advantage of any logging API over plain System.out.println resides in its ability to disable cert
原创 AtomicInteger 源碼以及對CAS的理解 原
public class AtomicInteger extends Number implements java.io.Serializable { private static final long serialVersion