The more you know, the more you don’t know


Like it and see. Make it a habit


This article has been included in GitHub github.com/JavaFamily, there is a mind map for the pilot of big factory surface, and I have also sorted out a lot of my documents, welcome Star and perfect, you can refer to the examination points for review in the interview, I hope we can have something together.

preface

Do you still remember the readers of CHONGQING Post and Telecommunications Research Institute ii that I mentioned last week?

,

I was also very happy to know that he got the Offer, so I wanted to share his interview experience and interview questions, so that everyone can know what the interview is like at present.

What is excellent is that he would make summaries for each interview by himself. He directly gave me the documents as soon as I told him. Excellent son, I may know the reason why he got so many offers.

I was going to post the whole article about the interview process, then post the following questions and be done with it.

But you will certainly scold me to cheat and play with women’s feelings of the man, irresponsible, the topic has not given me the answer.

I warm male come, finally wrote the answer to you, don’t love me, no result.

The body of the

It was a crisp autumn morning, and Angela was sleeping late as usual. Her snoring was weaker and stronger.

Ding, ding, ding, ⏰ The alarm went off, and Angela, as usual, closed her eyes and turned off her cell phone, ready to fall asleep.

Suddenly a shock, Angela thought of what, “there are baidu and JINGdong interview today, lie * almost overslept”.

In the blink of an eye, Angela is already sitting in the conference room, which is opposite jingdong and Baidu. (I integrated the problems of the two sides of the company and did the rework)

The door opens, and a paunchy, middle-aged man in a plaid shirt walks toward you with a scratched MAC. He looks at his bald hair and thinks he’s a top architect.

Does that sound familiar? He was the interviewer for my first essay

Introduce yourself, and introduce the projects you have done.

My name is Angela Bingbing, 23 years old. I come from Zunyi, Guizhou province and graduated from Lanxiang Technical Vocational School majoring in Electronic Information Engineering. I have worked for two years.

My current company is Tmall International, and I am mainly responsible for the research and development of the activity team as the group leader. During my one year in the company, I have participated in more than 30 activities, both large and small, and brought nine GMV activities of over ten million yuan to the company. The projects I am responsible for are mainly using the design idea of micro-service and the distributed deployment mode.

I often use middleware such as Redis, RocketMq, ElasticSearch, Logstash, Canal, Dubbo and so on. I have in-depth research and insight into the source code of Dubbo, and I also wrote an RPC-like framework with Netty imitating Dubbo. It is now open source on GitHub and has 20,000 stars.

He also writes technical blogs in his spare time and has a following on major blog forums.

I have some understanding of all the business processes of e-commerce, have my own understanding of online problem handling and performance tuning, and am quite familiar with the business research and development design process.

Due to personal reasons, I chose to quit my job. If I have the honor to join your company and work together, I think I can get started in the first time and produce results. Above is my self-introduction, thank you for your interview.

This is Angela’s interview question. Angela: What are you doing?

Angela c c? I see on your resume that you were a project leader. What jobs did you do after that? Talk about what you learned.

Hello, handsome interviewer. After entering the company, I became the team Leader due to the project transfer, which was not as cool as I expected, because I was responsible for my own responsibilities before. Now I need to have a general view of the project, control the project progress, and Review the codes and schemes of team members.

All my classmates were excellent. If I wanted to control them, I had to force myself to keep learning. Therefore, this period of time was very painful, but the harvest was real.

Have you seen the HashMap source?

Yeah, I’ve seen this before, because in the actual development process, Map is a common interview question.

Put () in JDK1.7

JDK1.8 has those changes.

What are the thread unsafe issues in HashMap in JDK1.7? What are the reasons?

After JDK1.8, how to link address method, what is the length of the list will be converted to red black tree.

At what number of nodes, the red-black tree will go back to the list.

Why 8 was chosen as the threshold for the list to turn into a red-black tree?

According to the Poisson distribution, when the default load factor is 0.75, the probability that the number of elements in a single hash slot is 8 is less than one in a million. Therefore, 7 is regarded as a watershed, and the conversion is not performed when it is equal to 7, but when it is greater than or equal to 8, and when it is less than or equal to 6, it is transformed into a linked list.

What is the difference between HashMap and HashTable?

Have you heard about ConcurrentHashMap?

How does ConcurrentHashMap ensure thread-safety after JDK1.8? Synchronized, CAS+synchronized, CAS+synchronized, CAS+synchronized

What are the optimizations compared to JDK1.7?

HashMap ConcurrentHashMap ConcurrentHashMap ConcurrentHashMap ConcurrentHashMap

  • HashMap

  • ConcurrentHashMap&HashTable

Synchronized differs from synchronized before loading static and normal methods.

Synchronized refers to a nonstatic method that essentially locks the object on which the method is invoked.

Synchronized refers to static methods that actually lock objects of that class.

  • Only one object lock key can be mutually exclusive to ensure the uniqueness of shared variables
  • A lock on a static method is not the same as a lock on an instance method by default if synchronization requires two locks.
  • A lock on a method of the same class comes from the object calling the method. If the object calling the method is the same, then the lock must be the same; otherwise, it is not. For example, new A().x() and new A().x(), different objects, different locks, if A simple, can be mutually exclusive.
  • Static method locks, and all other static method locks mutually exclusive
  • Static method locking, like xx.class locking, belongs directly to the class

Since you are familiar with singletons, introduce singletons and say the difference between singletons slacker and hungry-hunk? (by hand)

Introduction to singletons:

Intent: Ensure that a class has only one instance and provide a global access point to access it.

Main solution: a globally used class is frequently created and destroyed.

When to use: When you want to control the number of instances and save system resources.

How to resolve it: Determine if the system already has this singleton, return it if it does, and create it if it does not.

Key code: Constructors are private.

Application examples:

  • There is only one head teacher in a class.
  • Windows is multi-process multi-thread, when operating a file, it is inevitable that multiple processes or threads operate a file at the same time, so all file processing must be carried out by a unique instance.
  • Some device managers are often designed in a singleton mode, such as a computer with two printers, and have to deal with the fact that two printers cannot print the same file.

Advantages:

  • Having only one instance in memory reduces the overhead of memory, especially the frequent creation and destruction of instances (such as the management school homepage page cache).
  • Avoid multiple resources (such as write file operations).

Disadvantages: No interface, no inheritance, conflicts with the single responsibility principle, a class should only care about internal logic, not how to instantiate outside.

Usage Scenarios:

  • Require production of unique serial numbers.
  • Counters on the WEB, instead of being added to the database with each refresh, are cached with singletons first.
  • Creating an object consumes too many resources, such as I/O connections to the database.

Note: synchronized (singleton.class) must be used in getInstance() to prevent instance instantiation by multiple threads entering simultaneously.

lazy

public class Singleton {  

    private static Singleton instance;  

    private Singleton (a){}  



    public static Singleton getInstance(a) {  

    if (instance == null) {  

        instance = new Singleton();  

    }  

    return instance;  

    }  

}

Copy the code

The hungry

public class Singleton {  

    private static Singleton instance = new Singleton();  

    private Singleton (a){}  

    public static Singleton getInstance(a) {  

    return instance;  

    }  

}

Copy the code

How to ensure thread safety in lazy mode?

public class Singleton {  

    private static Singleton instance;  

    private Singleton (a){}  

    public static synchronized Singleton getInstance(a) {  

    if (instance == null) {  

        instance = new Singleton();  

    }  

    return instance;  

    }  

}

Copy the code

What are the implementation methods for creating thread-safe singletons?

Double-checked locking (DCL, double-checked locking)

public class Singleton {  

    private volatile static Singleton singleton;  

    private Singleton (a){}  

    public static Singleton getSingleton(a) {  

    if (singleton == null) {  

        synchronized (Singleton.class) {  

        if (singleton == null) {  

            singleton = new Singleton();  

        }  

        }  

    }  

    return singleton;  

    }  

}

Copy the code

Registered/static inner class

public class Singleton {  

    private static class SingletonHolder {  

    private static final Singleton INSTANCE = new Singleton();  

    }  

    private Singleton (a){}  

    public static final Singleton getInstance(a) {  

    return SingletonHolder.INSTANCE;  

    }  

}

Copy the code

The enumeration

public enum Singleton {  

    INSTANCE;  

    public void whateverMethod(a) {  

    }  

}

Copy the code

What about the MEMORY model of the JVM? (Each module says)

The Method Area is where you can put class definitions, constants, compiled code, static variables, etc. In JDK1.7, the HotSpot VM implementation puts it in a persistent generation. This has the advantage of being managed directly using the GC algorithm in the heap. In JDK1.8, HotSpot VM cancels persistent generation and replaces it with meta Space, which uses local memory directly and can theoretically use as much memory as the computer has. Therefore, the PermGen Space exception will no longer occur.

Almost all objects, arrays, etc. are allocated in this area, which accounts for a large proportion of THE JVM’s memory. It is also the main site for GC garbage collection.

When the JVM executes a method, it creates a Stack frame in this area to hold various information about the method, such as the return value, local variables, and various object references. The Stack frame is created before the method is executed and then removed from the Stack.

The Native Method Stack is similar to the virtual machine Stack, but the difference is specific to Native methods.

The Program Counter Register takes up a small area, and we know that the JVM executes bytecode line by line, so we need a Counter to keep track of the number of lines currently being executed.

Are you familiar with garbage collection algorithms? What are the garbage collection algorithms?

Mark clear

The mark-sweep algorithm divides garbage collection into two phases: the tag phase and the sweep phase.

In the marking phase, all objects starting from the root node are marked by GC Roots. Unmarked objects are garbage objects that are not referenced. Then, in the purge phase, all unmarked objects are cleared.

Replication algorithm

Scan from the root collection node, mark all living objects, copy these living objects to a new memory (the lower memory), and reclaim the original memory (the upper memory)

Tag to sort out

The high efficiency of the replication algorithm is based on the premise of fewer live objects and more garbage objects.

This happens a lot in the new generation, but it’s more common in the old age that most objects are living objects. If the replication algorithm is still used, the cost of replication will be high due to the large number of viable objects.

Generational collection algorithm

The generation collection algorithm is the current collection algorithm used by virtual machines. It solves the problem that mark collation is not suitable for the old age, and divides the memory into various generations. Under normal conditions, the reactor is divided into the Tenured Generation and the Young Generation, and beyond the reactor is the Permanet Generation.

Different algorithms are used in different generations, so as to use the most suitable algorithm. The survival rate of the new generation is low, so the replication algorithm can be used. But the old age object survival method, there is no extra space for it to allocate guarantees, so can only use the tag clearing or tag cleaning algorithm.

How to determine whether an object should be reclaimed.

In order to solve the problem of circular reference, Java adopts the way of forward reachable, mainly through the Roots object as the starting point of search, the search path is called “reference chain”, when an object is not connected to Roots by any reference chain, it proves that the object is not available. Of course, objects judged unreachable do not necessarily become recyclable.

Were judged as unreachable object is to be a recycled object must experience at least two tag process, if there is still no escape in the process of the two markers, likely to be recycled object is basically to really become a recycled object, can be recycled in fact mainly depends on the finalize () method to have associated with reference object on the chain, If there is an association in Finalize (), the self-saving object will succeed, and the modified object cannot be collected. If there is no association, the success will be marked as a success twice, and it can be called garbage to be collected.

In addition to garbage collection, what other tasks can cause excessive CPU load? .

Describe the features of the CMS garbage collector and G1 collector, and the collection process.

The CMS collector is a collector whose goal is to obtain the shortest collection pause time. Based on the “mark-clear” algorithm, its operation process is as follows:

  • Initial tag

  • Concurrent tags

  • To mark

  • Concurrent remove

    The two steps of initial marking and new marking still need to “stop the world”. The initial marking only marks the objects that GC Roots can be directly associated with, which can be read quickly. The concurrent marking stage is GC Roots Tracing. The re-marking stage is to correct the marking record of the part of the object that is marked to move because the user program continues to run during concurrent marking. The pause time of this stage is generally a little longer than that of the initial marking stage, but much shorter than that of concurrent marking. CMS is an excellent collector with the main advantages of concurrent collection and low pauses.

Disadvantages:

  • The CMS collector is very sensitive to CPU resources. In the concurrent phase, it does not cause user threads to pause, but it does slow down the application and reduce overall throughput by taking up a portion of the threads.

  • The CMS collector is unable to handle floating garbage, which can result in a Full GC due to a Concurrent Mode Failure.

Floating garbage: Since the CMS concurrent cleanup phase user threads are still running, new garbage is naturally generated along with the program running. After this part of garbage is marked, CMS cannot dispose of it in the current collection and has to leave it for the next garbage collection. This garbage is known as floating garbage.

  • CMS is a collector implemented by “mark – clear” algorithm, which is prone to large amount of space debris. When space debris is too much, it will bring great trouble to the allocation of large objects. Often, there will be a lot of space left in the old years, but they cannot find a large enough continuous space to allocate the current object, so they have to trigger a Full GC in advance.

G1 is a garbage collector for server-side applications. G1 has the following features:

  • Parallel to Concurrent: The G1 takes full advantage of CPU, multi-core hardware, and uses multiple cpus (cpus or CPU cores) to reduce stop-the-world pause times. While other collectors would have paused GC actions performed by Java threads, the G1 collector can still allow Java programs to continue executing concurrently.

  • Generational collection: Although G1 can manage the entire GC heap independently without the cooperation of other collectors, the concept of generational collection is retained. It can handle newly created objects differently from old objects that have been around for a while and have survived multiple GC’s for better collection.

  • Spatial consolidation: Different from CMS’s “mark-clean” algorithm, G1 is a collector based on the “mark-clean” algorithm as a whole; Locally, it is based on a “copy” algorithm.

  • Predictable pauses: This is another big advantage G1 has over CMS. Reducing pause times is a common concern of BOTH G1 and CMS, but G1 also models predictable pause times, allowing users to specify a time segment of M milliseconds in length.

  • G1 Operation steps:

1. Initial mark; 2. Concurrent markup; 3. Final marking; 4. Screening and recycling

String a = “ABC”; And String b = new String(” ABC “); Is it the same? Why is that? What are their corresponding memory Spaces?

Not the same

A constant pool is a collection of data identified at compile time and stored in compiled bytecode files. It includes constants in classes, methods, interfaces, etc. It holds string constants and primitives (public static final). The stack (stack)

It holds references to basic data types (or built-in types) (char, byte, short, int, long, float, double, Boolean) and objects. Data can be shared, second only to registers and faster than heaps. So they are false at ==

Talk about how the JVM creates objects.

Symbolic references to the location class in the constant pool

​ ↓

Check whether the class represented by the symbol reference has been loaded, parsed, and initialized →

Left left

Allocate memory (memory requirements are determined after class loading is complete) ← Load

​ ↓

The allocation method is selected based on whether the Java heap is tidy (GC method)

​ ↙ ↘

Pointer collision free list

​ ↓

Concurrency guarantee of allocated memory (atomicity of pointer updates)

​ ↙ ↘

CAS+ failed retry Tlab-xx :+ usetlab-xx :-UseTLAB

​ ↓

Memory space is initialized to a value of 0 to ensure that the instance fields of the object can be used without initial values.

​ ↓

Set Object headers: reference Pointers, metadata, hash values, GC generation ages, lock dependencies

​ ↓

Execute object methods

Byte a = 127, byte B = 127; What’s the problem with the difference between a+=b and a = a+b?

A plus b is going to be negative.

A =a+b will cause an error.

Forced type promotion

Are you familiar with mysql? Let’s talk about the isolation level of mysql and the corresponding problems.

Read Uncommitted

At this isolation level, all transactions can see the execution results of other uncommitted transactions. This isolation level is rarely used in real-world applications because its performance is not much better than other levels. Reading uncommitted data is also known as Dirty reads.

Read Committed

This is the default isolation level for most database systems (but not for MySQL). It satisfies a simple definition of isolation: a transaction can only see the changes made by committed transactions. This isolation level also supports what is called Nonrepeatable Read, because other instances of the same transaction may have new COMMITS in the process of that instance, so the same SELECT may return different results.

Repeatable Read (Repeatable Read)

This is MySQL’s default transaction isolation level and ensures that multiple instances of the same transaction will see the same rows when they concurrently read data. In theory, though, this leads to another thorny problem: Phantom Read. Simply put, phantom reading refers to when a user reads a row in a certain range, another transaction inserts a new row in that range, and when the user reads a row in that range, a new phantom row is found. InnoDB and Falcon storage engines address this problem through the Multiversion Concurrency Control (MVCC) mechanism.

Serializable

This is the highest isolation level, and it solves the phantom problem by forcing transactions to be ordered so that they cannot conflict with each other. In short, it places a shared lock on each read row. At this level, a lot of timeouts and lock contention can result. The four isolation levels are implemented with different lock types, which can be problematic if the same data is read. Such as:

  • Drity Read: a transaction has updated a copy of data, and another transaction has Read the same copy of data. For some reason, the first transaction has rolled back, and the data Read by the second transaction is incorrect.
  • Non-repeatable read: Data inconsistency between two queries of a transaction. This may be because the original data updated by a transaction was inserted between the two queries.
  • Phantom Read: a transaction where the number of pens is inconsistent between two queries. For example, one transaction queries for rows and another transaction inserts new columns. The previous transaction will have unqueried columns in subsequent queries. An error is reported if data is inserted at this time and is inserted by another transaction.

What is MVCC and what is it mainly for?

Concurrency Control for MVCC(Mutil-version Concurrency Control). MVCC is a method of concurrency control, which is generally used in database management system to achieve concurrent access to the database.

In Mysql’s InnoDB engine, transactions at READ COMMITTD and REPEATABLE READ isolation levels access records in the version chain for SELECT operations.

This allows other transactions to modify this record, and each change will be recorded in the version chain anyway. SELECT can go to the version chain to get records, which implements read – write, write – read concurrent execution, improve system performance.

How do we optimize our database?

  • To optimize queries to avoid full table scans, first consider indexing where and order by columns.

  • Try to avoid null values for fields in the WHERE clause, as this will cause the engine to abandon the index for a full table scan

  • Use in where clauses should be avoided! = or <> otherwise the engine will abandon the index for a full table scan.

  • Avoid using OR to join conditions in the WHERE clause. If a field has an index and a field does not, the engine will abandon the index and perform a full table scan instead

  • In and not in should also be used with caution, otherwise full table scanning will occur

  • A like fuzzy full match will also cause a full table scan

Talk about the difference between MyBaits and Hibernate.

Thing in common:

MyBaits and HiBernate are both ORM object relational mapping frameworks and persistence layer data frameworks.

Difference:

  • HiBernate is a heavyweight framework, while MyBaits is a lightweight framework.
  • HiBernate for JDBC encapsulation is relatively deep, the ability of some SQL developers is not very high, only need to Hql statement operation object can complete the data persistence operation.
  • MyBaits is also a JDBC encapsulation, but not as deep as Hibernate, its SQL statements, are reconfigured, you can rewrite the configuration of SQL, to achieve data optimization, implementation is also more convenient.
  • When dealing with big data, MyBaits is recommended to optimize SQL statements more easily.

Hibernate state transformation relationships.

The latest Hibernate documentation defines four states for Hibernate objects, which are: Detached (new, or TRANSIENT), managed, or Persistent, detached, and removed (removed, none of the three states defined in the previous Hibernate document), as shown in the figure below, In previous Hibernate documents, the removed state was treated as transient.

  • Transient: When an entity object is new, the object is transient, that is, an area of memory that holds temporary data. If no variables reference the object, it will be collected by the JVM’s garbage collection mechanism.

    The data stored in this object has no relationship to the database, unless the Session save(), saveOrUpdate(), persist(), merge() methods are used to associate transient objects with the database and insert or update data into the database before the object becomes persistent.

  • Persistent: An instance of a persistent object has a record in the database and a persistent ID.

    After a delete operation is performed on a persistent object, the corresponding record in the database will be deleted. Then the relationship between the persistent object and the database record will no longer exist, and the persistent object becomes removed state (which can be regarded as transient).

    Changes to persistent objects are not immediately synchronized to the database until the database transaction commits.

  • Free: When a Session is closed (), clear(), EVict (), or flush(), the entity object changes from a persistent state to a free state. Although the object has persistent and consistent identity values with the corresponding database records, the object is not managed by persistence because it has been removed from the Session. So it’s in a free state (also called an out-of-tube state).

    A free-state object is very similar to a temporary state object, except that it also contains a persistent identifier.

Talk about Spring’s understanding of how IOC and AOP are used in projects.

Spring is an open source framework, control layer in the MVC pattern, it can respond to rapid changes in demand, the main reason it is a kind of the advantage of aspect oriented programming (AOP), secondly it improves the system performance, because through the dependency inversion mechanism (IOC), the system used in object is not all instantiated when the system load, Instead, the class’s objects are instantiated only when called, which improves system performance.

These two features have made Spring popular with many J2EE companies, such as Ali, which uses spring-related technologies the most.

Advantages of Spring:

  • The coupling between components is reduced and the decoupling between software layers is realized.

  • You can use many services that are easily available, such as transaction management, messaging services, logging, and so on.

  • The container provides AOP technology that makes it easy to implement functions such as permission interception and runtime monitoring.

Spring AOP technology is the design mode of the dynamic proxy mode, just to implement the DYNAMIC proxy interface provided by JDK InvocationHandler, all the methods of the proxy object by the InvocationHandler take over the actual processing tasks.

In section-oriented programming, you also need to understand pointcuts, cuts, notifications, weaving, and so on.

Two ways to implement AOP, and say which is more efficient and why.

There are two ways: one is the JDK dynamic proxy, the other is the CGLib way.

JDK dynamic proxy implementation principle:

  • Create your own call handler by implementing the InvocationHandlet interface;

  • Create a dynamic Proxy by specifying a ClassLoader object and a set of interfaces for the Proxy class;

  • Get the constructor of the dynamic proxy class through reflection, whose only parameter type is the calling processor interface type;

  • Create a dynamic proxy class instance using a constructor that calls a handler object as an argument.

The JDK dynamic proxy is an interface oriented proxy pattern, and Spring can’t do much about it if the promanaged target doesn’t have an interface. Spring uses Java’s reflection mechanism to produce a new anonymous implementation class for the promanaged interface, overwriting the AOP enhancements.

CGLib dynamic proxy:

CGLib is a powerful, high-performance Code production class library that can achieve runtime dynamic extension of Java classes. Spring inherits classes to be dynamically proxied at runtime through CGLib, overriding the methods of the parent class, and implementing AOP faceted programming.

Comparison between the two:

JDK dynamic proxies are interface oriented.

CGLib dynamic proxies are implemented through bytecode low-level inheritance of the proxy class (which will fail if the proxy class is decorated with the final keyword).

Performance:

In terms of performance between the two, JDK dynamic proxies created by proxy objects, in previous JDK versions, performance is not very high, although the performance of JDK dynamic proxies has been greatly improved in older versions, but it is not suitable for all scenarios.

It is mainly reflected in the following two indicators:

  • Dynamic proxy objects created by CGLib perform much better than JDK dynamic proxies in real time, some studies have shown that up to 10 times better.

  • However, CGLib takes much longer to create objects than JDK dynamic proxies, by a factor of eight, according to some studies.

  • Therefore, CGLib dynamic proxies are more suitable for Singleton or instance pool proxies because they do not need to be created frequently, and JDK dynamic proxies are more suitable anyway.

Talk a little bit about Spring’s transaction propagation mechanism.

There are several ways to keep in mind:

public interface TransactionDefinition {

    int PROPAGATION_REQUIRED = 0;

    int PROPAGATION_SUPPORTS = 1;

    int PROPAGATION_MANDATORY = 2;

    int PROPAGATION_REQUIRES_NEW = 3;

    int PROPAGATION_NOT_SUPPORTED = 4;

    int PROPAGATION_NEVER = 5;

    int PROPAGATION_NESTED = 6;

}

Copy the code
  • PROPAGATION_REQUIRED: If there is no transaction, create a new one, PROPAGATION_REQUIRED: If one already exists, add it to the transaction. This is the most common choice.
  • PROPAGATION_SUPPORTS: Supports the current transaction, and executes non-transactionally if there is no transaction currently.
  • PROPAGATION_MANDATORY: Use the current transaction, and throw an exception if there is no transaction currently.
  • PROPAGATION_REQUIRES_NEW: Creates a transaction, and suspends the current one if it exists.
  • PROPAGATION_NOT_SUPPORTED: Executes an operation in a non-transactional manner, and suspends the current transaction, if one exists.
  • PROPAGATION_NEVER: Executes non-transactionally, throws an exception if a transaction currently exists.
  • PROPAGATION_NESTED: Executes within a nested transaction if a transaction currently exists. If there are no transactions currently, an operation similar to PROPAGATION_REQUIRED is performed.

Required, RequiresNew, and Nested.

  • The transaction method determines whether a transaction exists, uses the existing one if it does, and restarts one if it does not.
  • RequiresNew: Simple to understand: Start a new transaction and suspend the current one if it already exists. The newly opened transaction has its own lock and isolation level, and can be committed and rolled back independently. During the execution of the inner transaction, the outer transaction is suspended, and after the execution of the inner transaction, the outer transaction is resumed.
  • Nested transactions are rolled back if an external transaction is rolled back. Nested transactions are committed only when external transactions are committed. Nested transaction rollback does not affect external transactions. A child transaction is a nested transaction of the upper level transaction. A savepoint is established before the child transaction executes. The rollback of the nested transaction will return to this Savepoint without causing the rollback of the parent transaction.

You can satisfy most scenarios with Required if you want the transactions to be executed together, and you can set the child transaction to RequiresNew if you don’t want the result of executing the child transaction to affect the commit of the parent transaction.

Is there anything you want to ask me?

Do we usually have technology sharing activities like jingdong baidu?

Some of you can rest assured that technology sharing we will be different colleagues take turns to share different technology stacks.

Ok, I have no problem with that, and I look forward to working with you.

conclusion

All the questions are the interview questions provided by the fans, I have checked all the questions and summarized the answers. In fact, you can see that many of the questions are the content of my usual article, and I basically follow the ideas of the interview to write.

And the interview topics are very basic, do not think jd Baidu interview is actually not difficult, we have to prepare really into the kind of, are the basis, in fact, usually pay attention to, do not need to assault what.

Pay attention and don’t get lost

Well everybody, the above is all the content of this article, I am Aobing, encourage to be a blogger that let everyone remember, can see here people, are talents.

I will update a few weekly Internet big factory interview and commonly used technology stack related articles, thank you very talented people can see here, if this article is written well, feel “AO third” I have something to ask for praise 👍 for attention ❤️ for share 👥 for warm male I really very useful!!

White piao is not good, creation is not easy, everyone’s support and recognition, is the biggest power of my creation, we see the next article!

AoBing | article “original”

If there are any mistakes in this blog, please comment, thank you very much!


This article has been included in GitHub github.com/JavaFamily. There is a pilot mind map of Dacang surface, and a lot of my documents have also been sorted out. Welcome Star and improvement. We can refer to the test points for the interview review, I hope we have something together.