In the previous post (Synchronized vs ReentrantLock in Java) , we have discussed the difference between synchronized and ReentrantLock. The keyword synchronized can be widely used in many multi-threaded environments. However, there are some drawbacks when using synchronized. The use of keyword synchronized provides access to the implicit monitor lock associated with every object, but forces all lock acquisition and release to occur in a block-structured way: when multiple locks are acquired they must be released in the opposite order, and all locks must be released in the same lexical scope in which they were acquired. In short, when the keyword synchronized locks a block, and a thread is in the block, other threads have to wait and will be blocked until that thread exits the block. It will slow down the performance. In some situations, it may leads to a deadlock. Continue reading
Tag Archives: Java
How to Optimize Tomcat Performance
The default Tomcat configuration looks powerful and hassle-free to the 1st time users. However, it is not customized for the real work where high server load can be expected. Therefore, it is important to optimize Tomcat performance by setting customization and system tuning.
The post will describe how to optimize Tomcat performance. Continue reading
Hibernate Session
The main function of a Hibernate session is to open a database connection, and offer read and update operations for instances. Each instance object associated with the session will keep alive until the session is closed or the object is deleted. Continue reading
JDBC CallableStatement
A CallableStatement is used to call stored procedures in a database. The post (“JDBC Batch Update”) will give a simple example, and show how to use JDBC CallableStatement to call stored procedures. Continue reading
JDBC Batch Update
The post (“JDBC Batch Update”) will give an example, and show how to use JDBC batch update. Continue reading
JDBC Delete Record Using PreparedStatement
The post (“JDBC Delete Record Using PreparedStatement”) will give an example, and show how to delete a record using PreparedStatement. Continue reading
JDBC Delete Record Using Statement
The post (“JDBC Delete Record Using Statement”) will give an example, and show how to delete a record using Statement. Continue reading
JDBC Update Record Using PreparedStatement
The post (“JDBC Update Record Using PreparedStatement”) will give an example, and show how to update records using JDBC PreparedStatement. Continue reading
JDBC Update Records Using Statement
The post (“JDBC Update Records”) will give an example, and show how to update records. Continue reading
JDBC Select Records
The post (“JDBC Select Records”) will give an example, and show how to select and parse records. Continue reading