I recently learned how to improve the thread pool and memory control.ProgramProgramming Technology in terms of running performance, I saw a good guy on the Internet, so I would like to share it with you.
[Sharing] principles and implementation of Java Thread Pool
In the past few days, I have been crazy about the source program. I have learned a lot of new knowledge (such as NiO), or a new technology, wh
listening events in different game modes, and listeners should always be implemented as interfaces in order to match needs.
Text, about the development of Java game should always adhere to the 10 Basic principles:
1, always maintain the uniqueness of the canvas.
In real life, the nutrients ingested by the human mouth and digestive tract can be absorbed by the heart, liver, spleen, lung, kidney and other
Java Class design principles
Hides the data of the class with the private modifier, avoiding direct user access to the data.
Provides a common, default construction method.
The properties shared by all instances in the class should be declared as a class property.
A class should describe a single entity or a collection of similar operations.
The data fields and operations that are shared w
Attachprovider OH// VirtualMachine vm = VirtualMachine.attach("pid");null;List providers = AttachProvider.providers();for (AttachProvider provider : providers) { try { vm = provider.attachVirtualMachine("pid"); break; catch (Exception e) { // do sth. necessary continue; }}The above code automatically matches the platform, so we don't have to worry about different operating systems choosing different types of attachprovider.Instrument and Attachapi are btrace
difference between = = and JavaScala's = = follows the comparison rules:First check whether the left side is null, if not, call the left manipulation data of the Equals method. Therefore, the exact comparison depends on the definition of the Equals method that makes the operation. Because of the automatic null check, there is no need to manually check it again.java = = can compare primitive types or reference types. For primitive types, the equality of the = = Comparison values for
Garbage collection Overview
A user program (mutator) modifies the object set in the heap area, obtains space from the storage manager, creates an object, and introduces and removes references to existing objects.
When mutator cannot "reach" some objects, these objects become garbage.
Objective: To find inaccessible objects and hand them over to the storage manager that tracks idle space to reclaim the resources they occupy.
Some Basic Concepts
Type security: the type of any data component is det
exact types we want. Now the class is generic, we can write: collection public static result = new ArrayListrun sql query using jdbc */ for ( /* iterate over jdbc results */ ) { T item = c.newInstance(); /* use reflection and set all of item’s fields from sql results */ result.add(item); } return result;}To get the collection we want in a type-safe way.This technique is a very useful technique and it has become a customary usage that is widely used in the new API for processing annotatio
deep understanding of Java annotation Principles
* Use of annotations
Annotations (Annotation) is a new feature introduced by JDK1.5, contained in the Java.lang.annotation package, is a bit of meta information attached to the code that links the external information of a class to internal members, parsing and using it at compile, runtime. Java has built-in annot
patterns and have never heard of a single principle of responsibility will consciously adhere to this important principle when designing software, because it is common sense. In software programming, no one wants to cause other functions to fail because a feature has been modified. The way to avoid this problem is to follow a single principle of responsibility. Although a single responsibility principle is so simple and considered common sense, even the program written by an experienced program
subclass overrides the member method of the parent class, then it is overwrite, that is, after new Zi (), there is only one method of the subclass in the new instance, whether the type you are declaring is a parent class or a subclass.2. If the subclass has a member variable of the same name as the parent class, then it is hidden, so the so-called Hide is New Zi (), there will be two member variables in the instance, whichever is determined by the type of claim.3. If the subclass overrides the
predictable. However, the reference relationship may have changed between two sections of the GC program. Therefore, this GC algorithm also writes the barrier to record the change of the reference relationship. Although this method controls the maximum interrupt time, the total GC time is increased due to the increased number of interrupts.With regard to incremental garbage collection, http://blog.csdn.NET/u011320646/article/details/38640703 this blog post is more vivid and needs to be read by
are guaranteed to be visible to thread B after the next thread B starts execution.
thread Termination Rule : Assume that thread A is in the process of executing, by making threadb.join () wait for thread B to terminate, then thread B is visible after the modification of the shared variable is queued to return after terminating.
The above eight are native Java rules that satisfy the happens-before relationship, but we can deduce from them other ru
even if no new threads are created in the program.
A Java application always runs from the main () method, and the Mian () method runs inside a thread, which is called the main thread.
Once a new thread is created, a new call stack is generated.
Thread population is divided into two categories: user thread and waiting thread
The JVM shuts down automatically when all user threads have finished executing. But the waiting thread is not indep
Two principles have been introduced in the previousOpen Closure principleSingle principle of responsibilityToday we'll look at another principle: the dependency inversion principle, which contains two aspectsA. High-level modules should not be dependent on low levels of modules, they should all rely on abstraction.B. Abstractions should not be dependent on specifics, but should be dependent on abstraction.In fact, these two sentences are summed up to
Basic Principles of java Design Patterns
Two principles have been introduced earlier.Open and closed PrincipleSingle Responsibility PrincipleLet's take a look at another principle: the Dependency inversion principle, which includes two aspects:A. High-level modules should not depend on low-level modules. They should all rely on abstraction.B. abstraction should n
is easier because most of the functionality of the base class can be automatically entered into the derived class through the inheritance relationship;It is easier to modify or extend inherited implementations.② Disadvantages:Inheritance reuse destroys wrappers, because inheritance exposes the implementation details of the base class to the derived class, which is also known as white-box multiplexing, and if the implementation of the base class changes, the implementation of the derived class h
Atitit. Principles for implementing inheritance and methods java JavaScript. NET C # php ...1. Implementation of inheritance issues 12. How do I copy a base class method? Using the prototype prototype, by impersonating object 13.2. How do properties inherit? 24. Comparison of several inheritance methods 25. Common Apply, call method 36. Reference 31. Implementation of inheritance issuesto implement inherit
Advantages and disadvantages of Atitit. Async await asynchronous programming principles and implementation of java c # php,
Advantages and disadvantages of Atitit. Async await asynchronous programming principle and implementation of java c # php
1. async await source 1
2. asynchronous programming history1
2.1. Thread Pool 2
2.2. Return Value 2
2.3. Semaphore 2
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.