原创 重寫object中的hashcode和equals方法

覆蓋equals方法 1.      Object中對equals、hashcode方法的實現 (1)    在object中直接用   ==比較引用是不是指向同一個對象 (2)    直接返回對象在內存中的地址   2.      什麼

原创 java內存模型問題

1.      什麼是JMM? JMM描述了在源代碼中定義的共享變量和底層計算機系統是如何處理這些變量的關係。 (1)    編譯器可以在把源代碼翻譯成機器指令的時候,對指令做重新排序 (2)    因爲計算機有緩存的存在,所以共享變量

原创 Double-checked locking

In software engineering, double-checked locking (also known as "double-checked locking optimization"[1]) is a softwa

原创 實現不可變類

1.      什麼是不可變類 不可變類是指一旦通過構造器初始化一個類的對象狀態後,在這個對象的生命週期內,它的內部狀態是不能改變的。例如java中的string、integer對象等等。 2.      爲什麼要設計不可變了,類不可變的

原创 使用GZIP壓縮的方式向客戶端傳輸響應數據

1, 工具類:測試客戶端是否支持GZIP編碼壓縮方式 & 獲得支持GZIP的PrintWriter對象 package freebsd; import java.io.IOException; import java.io.PrintWr

原创 Synchronization and the Java Memory Model

This set of excerpts from section 2.2 includes the main discussions on how the Java Memory Model impacts concurrent pro

原创 Java theory and practice: Fixing the Java Memory Model, Part 1

原文鏈接:http://www.ibm.com/developerworks/library/j-jtp02244/index.html The Java platform has integrated threading and m

原创 Lazy initialization

In computer programming, lazy initialization is the tactic of delaying the creation of an object, the calculation of

原创 jdbc批量插入、批量刪除、批量更新

一、JDBC的批量插入    JDBC批量插入主要用於數據導入和日誌記錄因爲日誌一般都是先寫在文件下的等。     我用Mysql5.1.5的JDBC driver 分別對三種比較常用的方法做了測試   方法一,使用PreparedSta

原创 Double-checked locking and the Singleton pattern

1.什麼是單例模式 單例模式的想法是保證只有一個Singleton object能創建,私有的構造器和公開的getInstance()方法保證只能創建一個對象。這種方式在單線程環境下是可以走通的,但是在多線程環境下,必須要保證getIns

原创 Java theory and practice: Fixing the Java Memory Model, Part 2

原文鏈接:http://www.ibm.com/developerworks/library/j-jtp03304/ Writing concurrent code is hard to begin with; the languag

原创 Struts2中jsp前臺傳值到action後臺的三種方式

struts2中的Action接收表單傳遞過來的參數有3種方法: 如,登陸表單login.jsp: <form action="login" met

原创 thread and share variable

1.share variable The simplest way for threads to share their results is to use shared variables. They should also use

原创 j2ee規範認識

完成了J2EE視頻的學習,三個系列的視頻感覺走的是那麼的艱難,在懵懵懂懂中進行着,在視頻進行的時候已經對J2EE以及EJB的大體框架進行筆記記錄和框架整理.接下來對在學習過程中的一些關鍵點進行總結!  J2EE是什麼?要想知道J2EE是什

原创 Rational Rose破解

方法一: 1、安裝Rational Rose2003時,在需選擇安裝項的時候,只選擇Rational Rose EnterPrise Edition即可,不需選擇其他項,之後選擇“DeskTop Installation from CD