8, Reflection mechanism of Java

1. Definition of reflection Java reflection mechanism is a reflection mechanism of Java language that can know all the properties and methods of any class in the running state of a program, and can call any method and property of any object. This kind of dynamic information acquisition and function ...

Posted by phppucci on Sun, 02 Feb 2020 00:38:16 -0800

Transaction annotation in Spring@Transactional

@Transactional attribute The @Transactional annotation can only be applied to public modifiers and will not work with other modifiers without error. @Transactional ly is typically added to an implementation class or implementation class method, not to an interface or interface method. @Transaction ...

Posted by The Wise One on Sat, 01 Feb 2020 18:12:33 -0800

SPI (Service Provider interface) mechanism

1, Loading mechanism of class The loader loading of classes in Java comes from files, networks, source files, etc. By default, the class loader of the jvm uses the parent delegation mechanism, Bootstrap ClassLoader, Extension ClassLoader, and attachment classloader (system classloader). Each class l ...

Posted by xXx_Hobbes_xXx on Sat, 01 Feb 2020 09:01:24 -0800

Atomic Operation Classes in JUC and Their Principles

Yesterday we looked briefly at the use of Unsafe. Today we look at how atoms in JUC use Unsafe and how they work!   1. Simple use of AtomicLong Also remember that in the last blog we used the volatile keyword to modify a variable of type int, and then two threads did 10,000 + 1 operations on the variable, and the result wasn't 20,000. Now when ...

Posted by ckuipers on Wed, 29 Jan 2020 09:46:39 -0800

Java string constant pool

Character string Literal amount of string: refers to the string itself, such as "Java", "Hello". String object: for example, new String("abc") or direct String s="str". The following "str" is also a string object. String reference: a reference is a variable that points to the corresponding stri ...

Posted by raw100 on Wed, 29 Jan 2020 04:59:03 -0800

Using enumeration in Java well, it's not so simple!

Recently, I revisited Java enumeration and saw this article that I thought was good, so I simply translated and improved some content and shared it with you. I hope you can also get something. In addition, don't forget that there is a supplement at the end of the article! ps: here is an enumeration article, which is also a very practical pract ...

Posted by habib009pk on Wed, 29 Jan 2020 00:19:07 -0800

Test: OutOfMemoryError exception

Catalog 1, purpose 2. Practice (jdk8) 2.1 Java heap overflow 2.2 virtual machine stack and local method stack overflow 2.3 method area and runtime constant pool overflow 2.4 local direct memory overflow Reference resources 1, purpose Verify the contents stored in each runtime area described ...

Posted by ahmedkl on Tue, 28 Jan 2020 20:04:03 -0800

Difference between Synchronized and Static Synchronized

By analyzing these two usages, we can understand the concept of lock in java. One is instance lock (lock on an instance object, if the class is a single instance, then the lock also has the concept of global lock). The other is global lock (the lock is for a class, no matter how many objects are instance, then the thread shares the lock). The i ...

Posted by Syphon on Tue, 28 Jan 2020 06:59:34 -0800

Features of single case mode and analysis of common single case mode (analysis of six single case modes)

Single case mode: That is to say, in the whole life cycle, the production of this object is always the same, unchanged. It ensures that a class has only one instance and provides a global access point to access it. Effect: When thread safety is required, the uniqueness and thread safety of class instances are guaranteed. When multiple instan ...

Posted by elle_girl on Mon, 27 Jan 2020 04:46:28 -0800

Common methods of spring jdbctemplate class

execute(String  sql)    Any sql statement can be executed, but the return value is void, so it is generally used for database creation, modification, deletion and data table record addition, deletion and modification.     int  update(String sql)  int  update(String sql, Object...args) Add, delete, args passes the actual parameter, and retur ...

Posted by zapa on Mon, 27 Jan 2020 02:59:52 -0800