Dynamic proxy is commonly used in popular java frameworks, such as Spring, MyBatis and so on. There are other ways to implement proxy by using aspect or javassit and so on third part frameworks. In this page I will show you JDK dynamic proxy.
When I POST some xml data to server by using chrome I got the error message like following.
There are 6 states for Java Thread. From JDK comment it says that A thread can be in only one state at a given point in time. In this page I will show you different states in thread life cycle. Hope the sample code can help you understand the states better.
Template method pattern is commonly used in this scenario that main logic is stable but sub steps are not. Let's say you want to add export function in your system. For different data source there are different way to export data, but the main steps are the same: "getData", "processData" and "export". Let's try to use template method pattern in this example.
After downloading and unzipping the tar.gz file of IDEA I can start it by executing idea.sh. But I want to add it in Linux mint applications menu. For Linux mint the applications menu info is in / usr / share / applications /. Creating the file idea.desktop in this directory. The content is like following.
I have an old laptop with 4G memory and T6600 CPU. It installed Windows7 before and it runs slower and slower recently. I decide to install linux on it. Finally I choose Linux mint with xfce. It is not very beautiful but it's lightweight and use less memory. For the default Chinese fonts is not very clear. After google I use following command to make the fonts become clearer.
There are two ways to show remote repository in git.
Cache is very important for the project. Redis or MemoryCache are good choose for distribution project. If you want use local cache for your project guava is a good choose. I will show you how to use guava cache in this page.
Java provides several bitwise operators: &, |, ^ and ~. This page shows you how to use them.
State Pattern is for the scenario which contains different states. Let's consider the state of Amazon orders. When you want buy goods from Amazon the logic flow is: create order -> pay -> send goods -> receive goods -> evaluate. The status of order is changed after every operation and the action of order is changed correspondingly. The example code is like following.
There are two ways to find nth Fibonacci number: recursion and loop. Recursion is easy to write but is inefficient. Loop is not easy to write but efficient.
If you can not make sure the execution order of block, static-block and constructor. This blog will write a demo to help you understand the order of initializing fields.
This series of blog describes common algorithms.
In this page I will show you how to reverse single linked list in loop. Before starting write logic we need defined Node class.
Sometimes Java process used 100% or 200% CPU. It depends on the core number of your CPU. If your CPU has 8 cores that means the highest usage of a process is 800%. When Java process consuming most CPU you can use the following steps to find which Java threads is consuming the most CPU.