Design Patterns - Dynamic Agent Patterns
Dynamic agents are used in many low-level frameworks, such as struts, Spring and so on.
Dynamic proxy is mainly used for method enhancement, so that you can enhance some methods without modifying the source code, and do whatever you want before and after method execution.
Because in InvocationHandler's invoke Method, you can directly get the Me ...
Posted by dreamcaster on Sun, 30 Jun 2019 01:34:25 +0200
The Use of Four Thread Pools in Java
Java provides four thread pools through Executors, namely:
New CachedThreadPool creates a cacheable thread pool, which can flexibly reclaim idle threads if the length of the thread pool exceeds the processing requirements, and if not, create new threads.
New Fixed ThreadPool creates a fixed-length thread pool that controls the maximum num ...
Posted by PAFTprod on Fri, 28 Jun 2019 21:42:45 +0200
1. Multithread security 2. Waiting for wake-up mechanism
01 Thread Operation Sharing Data Security Issues
* A: Thread Operation Sharing Data Security
If there are multiple threads running at the same time, these threads may run the code at the same time.
The result of each run of the program is the same as that of single thread, and the value of other variables is the same as expected, which is threa ...
Posted by ZaphodQB on Wed, 26 Jun 2019 01:14:08 +0200
Understanding JAVA Event Handling Mechanism from scratch (3)
We have written two sections of teacher-student examples in succession, which must be bored to death. For example, we play 100 times or don't know how to write real code. So, starting with this section, we're starting to move closer to the real code.
The easiest example of an event to understand is the mouse event: we click on the mouse, the m ...
Posted by lucerias on Mon, 24 Jun 2019 22:28:41 +0200
New features of Java 8
Java 9 is coming, so we have to sort out Java 8.
Official documents: http://docs.oracle.com/javase/specs/jls/se8/html/index.html
I. Default and static methods of interfaces
The method body can also be written in the interface. The class that implements the interface no longer enforces the implementation of the method, but only needs to add defa ...
Posted by Large on Sat, 22 Jun 2019 23:15:13 +0200
Source Code Analysis of Bootstrap Initialization Process--Start of netty Client
Bootstrap initialization process
netty's client boot class is Bootstrap. Let's take a look at the initialization process of Bootstrap in the client part of spark's rpc.
TransportClientFactory.createClient(InetSocketAddress address)
Simply post out the Bootstrap initialization code
// Client boot object
Bootstrap bootstrap = new Bootstrap();
// ...
Posted by gonsman on Sat, 22 Jun 2019 21:04:18 +0200
Signature Configuration of Android studio
We can create a new project and then generate a new signature file. Generally speaking, after these operations, we can package by clicking Build - > Generate Signed APK - > Next in the upper left corner, and then selecting the corresponding Build Type.
That's too much trouble for some people. They have to input relevant informatio ...
Posted by immot on Sat, 22 Jun 2019 20:00:32 +0200
Comparable vs. Compparator
1. Prototype of two interfaces
In Java, Comparable and Comparator interfaces are used for comparison. So what's the difference between the two interfaces in actual use? Now let's analyze it with examples.
Let's first look at the prototype of the two interfaces in JDK.
package java.lang;
import java.util.*;
public interface Comparable< ...
Posted by dotancohen on Sat, 22 Jun 2019 00:51:46 +0200
Java proxy mode is simple to organize
Previously, I learned the proxy mode of Java, and I was deeply impressed by how wonderful this mode is!A simple tidy up for later viewing.
Definition: Provides a proxy for other objects to control access to this object.(e.g. train ticket agent point)
Classification:
Remote AgentVirtual AgentProtection AgentSmart Reference Agent
Smart Refere ...
Posted by AdamSnow on Fri, 21 Jun 2019 18:55:07 +0200
A zip file operation resulted in a JVM crash
1. Overview
Program Operating System: CentOS6.5 64bit
JDK Version: 7
2. Testing
2.1 Prepare test program
The test program is simple, just like a class, a main function, the general flow:
The interval for getting the zip file from the parameter is read first, then the zip file path is obtained from the parameter.Then get the full path ...
Posted by SheetWise on Fri, 21 Jun 2019 18:39:57 +0200