[Java in-depth study] 6. Detailed explanation of CGLib dynamic proxy mechanism

First, let's talk about dynamic proxy in JDK: Dynamic proxy in JDK is implemented by reflective class Proxy and InvocationHandler callback interface However, the dynamic proxy class in JDK must implement an interface, that is to say, it can only proxy the methods defined in the interface. This has some limitations in practical programming, and ...

Added by ram4nd on Fri, 12 Jul 2019 21:53:45 +0300

JAVA Thread Pool Details

JAVA Thread Pool Details Description: Based on JDK 1.7.0.79 Why use thread pools instead of displaying create threads Reduce the time spent creating and destroying threads and the overhead of system resources to resolve resource shortages; The absence of a thread pool can cause the system to create a large number of similar threads, lead ...

Added by smilinmonki666 on Fri, 12 Jul 2019 21:03:31 +0300

jdk source code analysis (5) - HashMap

I. Basic concepts Hash table: also known as hash table, is a commonly used data structure. It can access data directly according to the key value, so as to write and search data within the time complexity of O(1).Hash function: A function that maps a key value to a location in a hash list.Collision: Sometimes different key values are mapped ...

Added by lordphate on Mon, 08 Jul 2019 23:54:18 +0300

Use and Analysis of Enum

Example: package test; public enum ColorEnum { RED, YELLOW, BLUE, GREEN, BLACK,; } Obviously, enum is very similar to a special class, in fact, the type defined by the enum declaration is a class.These classes are subclasses of the Enum class in the class library (java.lang.Enum<E>).They inherit many useful methods ...

Added by ikebaldo on Sun, 07 Jul 2019 19:12:58 +0300

Analysis of Concurrent HashMap Principle

Understanding the principles of Concurrent HashMap implementations, it is recommended that you first understand the following HashMap Realization principle.HashMap source code parsing (JDK 1.8) Why use Concurrent HashMap Hashtable is thread-safe, but it uses synchronized method to synchronize. Both insert and read data are synchronized. When in ...

Added by jminscoe on Sun, 07 Jul 2019 05:27:32 +0300

[Java Concurrency] Details ThreadPool Executor

Preface Thread pool is a common optimization method in concurrency. Thread reuse can reduce thread creation, reduce resource consumption and improve program response speed. In Java, we usually create thread pools through the factory method provided by Exectuors, but the final implementation class of thread pools is ThreadPoolExecutor. Let's ana ...

Added by jasonok6 on Sun, 07 Jul 2019 04:17:16 +0300

JAVA Common Collection Source Parsing Series-ArrayList Source Parsing (based on JDK8)

The article was originally created by the author. If it is reproduced, please indicate the source. If it is the same, it is the same. ~ (who care!) 1. Write before This is the first part of the Source Analysis Program. The blogger is going to pass through some of the commonly used collection sources, such as ArrayList, HashMap and their corresp ...

Added by D1proball on Sat, 06 Jul 2019 20:31:55 +0300

Explain the Worker of ThreadPool Executor

The Worker class not only implements Runnable, but also inherits AbstractQueued Synchronizer, so Worker itself is an executable task, and can also realize the function of locks. Worker is mainly used to manage the interruption status of threads and some indicators, such as the number of tasks completed; Worker simplifies the operation of acquir ...

Added by Idri on Fri, 05 Jul 2019 01:26:23 +0300

Generic Programming

1. Why use generic programming Generic programming means that code written can be reused by many different types of objects. Before adding generic classes to Java (JDK 1.5), generic programming was implemented through inheritance. For example: public class ArrayList { private Object[] elementData; public Object get(int i){......} ...

Added by Frapster on Thu, 04 Jul 2019 22:09:04 +0300

java Dynamic proxy, Proxy and Invocation Handler

Read a lot of articles about agency, understand and organize them. 1. Basic Composition of Agency Abstract Roles: Declare common interfaces between real objects and proxy objects so that proxy objects can be used wherever they are used. Proxy roles: Proxy objects contain references to real objects so that they can be manipulated at any time. Th ...

Added by Snewzzer on Wed, 03 Jul 2019 01:32:12 +0300