The difference between Runnable and Thread in Java

There are two ways to implement multithreading in java, one is to inherit the Thread class, the other is to implement the Runnable interface; the Thread class is defined in the java.lang package. As long as a class inherits the Thread class and overrides the run() method in this class, it can achieve multithreading operation, but a class can on ...

Posted by sandrob57 on Wed, 27 Mar 2019 01:27:30 -0700

java multithreading (3) thread synchronization and communication

1 Thread Synchronization Thread synchronization refers to collaboration, assistance and cooperation, refers to the collaboration of multiple threads to access critical resources. Why synchronize threads? The main problem is thread visibility. How to realize thread synchronization in java? Generally speaking, there are several ways to sync ...

Posted by lnenad on Tue, 26 Mar 2019 20:45:29 -0700

java pattern design-dynamic proxy

In learning Spring, we know that Spring has two main ideas, one is IoC, the other is AOP. For IoC, dependency injection needn't be said much. For Spring's core AOP, we not only need to know how to satisfy our functions through AOP, but also need to learn the underlying principle, and the principle of AOP is the motive of java. The state proxy ...

Posted by mahdi_20 on Tue, 26 Mar 2019 01:51:30 -0700

Implementing Object Cloning in java

1. Why Clone In java, it's easy to copy a variable int a = 5; int b = a; Not only the int type, but the other seven primitive data types (boolean,char,byte,short,float,double.long) are also applicable to this type of situation. But if we need to copy an object, it is incorrect to use the "=" symbol of a variable to copy, exce ...

Posted by t0ta11 on Mon, 25 Mar 2019 15:06:29 -0700

Talking about the mechanism of multithreading lock

Lock mechanism in Java synchronized - The keyword of the Java language, when used to modify a method or block of code, ensures that at most one thread executes the code at the same time. When two concurrent threads access this synchronized synchronized block of code in the same object Object, only one thread can be executed in one time. Ano ...

Posted by KissMyBrain on Sat, 23 Mar 2019 17:48:52 -0700

JAVASE Foundation - day08 (Object Oriented)

08.01 Object Oriented (Overview and Classification of Code Blocks) (Understanding) (Interview questions, development is not used or rarely used) A: Overview of Code Blocks In Java, code enclosed with {} is called a block of code. B: Code Block Classification According to its location and declaration, it can be divided into local code block, ...

Posted by drewklue on Fri, 22 Mar 2019 03:36:53 -0700

JAVASE Foundation - day07 (Object Oriented)

07.01_Object-Oriented (Overview and Format of Constructor Construction Method) (Master) A: Summary of tectonic methods and their functions Initialize data (attributes) of an object B: Format Characteristics of Construction Method a: Method name is the same as class name (size is the same as class name) b: No return value type, not even voi ...

Posted by LAEinc. Creations on Thu, 21 Mar 2019 23:03:53 -0700

Java Multithreading Foundation - Lock Class

As mentioned earlier, JVM provides synchronized keywords for synchronized access to variables and uses wait and notify for inter-thread communication. After jdk1.5, JAVA provided Lock classes to implement the same functions as synchronized, and also provided Condition s to display inter-thread communication. Lock classes are functions provided ...

Posted by rajivgonsalves on Thu, 21 Mar 2019 19:12:53 -0700

ES2.4.1 double instances of ELK are smoothly upgraded to 5.2.1 and supervisor management notes

The 2.4.1 version of ES used in the old cluster has been running well and has not moved. Recently, the data ES5.X has been stable and its performance has been greatly improved, which makes my heart itchy. However, to maintain the high availability of business, I have to think of a smooth upgrade scheme. Finally, I think of a method of excessive ...

Posted by newyear498 on Thu, 21 Mar 2019 03:15:52 -0700

Use of java-nio-buffer ByteBuffer, Netty ByteBuf and Mapped ByteBuffer

Use of java-nio-buffer ByteBuffer, Netty ByteBuf and Mapped ByteBuffer Article directory Use of java-nio-buffer ByteBuffer, Netty ByteBuf and Mapped ByteBuffer 1.ByteBuffer 2.MappedByteBuffer 3 Netty's ByteBuf 4. test Environmental Science idea2018,jdk1.8 Notes on the use of buffer ByteBuffer, Netty ByteBuf and Mappe ...

Posted by Zaxnyd on Mon, 18 Mar 2019 01:33:27 -0700