Java Face question Collection

Source: Internet
Author: User

Recently in the water test, but also want to know their current level at which stage.

Some of the topics mentioned in the interview are collected, and there may be some deviations from personal understanding. Fill it up at 1.1.

1. Thread gets the value of the output

Implement interface callable for objects that require output to return the specified value and use the thread pool Executorservice the thread pool to return the specified value, theSubmit method can trigger

Return to the future to get the return value

configuration of the 2.spring Maybatis

DataSource Introduction, open Sqlsessionfactory

Scan Mapper XML, transaction annotations, require slices

Plugin pagehelper for paging configuration

How the 3.spring mybatis caching mechanism works

The status of Cacheenable needs to be turned on in the MyBatis configuration file because the default is False, the cache is turned on,

At the end of the crud, the cache refresh Flushcache to True this is the key point, because if not configured, will cause the read dirty data

The default is to have a first-level cache, open two-level cache will need to open, when some methods do not need to use the cache, then inject the corresponding query business method settings UseCache

The cache can also be scheduled to refresh, to avoid data updates are not timely. Use the eviction as the LRU default, configure interval to be 1000, refresh time custom. This depends on whether the business is necessary to do so. Because the caching mechanism is nothing more than a better use of the readability of the data

to False .

A level one or two cache is a sqlsession object that stores data. Because there are more than one session. Therefore , you need a level two cache when querying the cache across sessions.

Reference: https://www.cnblogs.com/DoubleEggs/p/6243223.html

Common Transactions for 4.spring

Roll back the transaction, TransactionManager in the configuration file, and use the annotation driver to inject the transaction.

You can then perform a dynamic configuration transaction on the corresponding business logic that needs to be handled, that is, the injection configuration of transactional, which must be used for the configuration of public publicly to take effect, and to handle small transactions. Because the processing of large transactions will result in a weaker feedback on the consistency of the data, more likely to lock up and lock the situation of the library risk

5. What are the ways to implement threading

Instantiate the thread to implement the Runnable method.

Here need to expand to the thread pool,the use of Executorservice, remember to configure the number of thread pool to use, generally with the server CPU core number +1. Be sure to follow the server's configuration to evaluate it, otherwise it will take the whole thread down. Memory overflow is generally indicated.

the difference between 6.string StringBuffer StringBuilder

String is an object that generally operates in a small number and is not required to splice the strings recommended using this slowest

StringBuffer is a string variable thread-safe multithreaded use is moderately efficient because the wired lock

StringBuilder is a string variable thread that is unsafe for single-threaded use is best in efficiency

the principle of 7.spring injection

Which is the IOC injection

There can be two configurations, one configured through a configuration file and one that is dynamically configured with code, both available.

The principle is loading, parsing, registering,

Loading is creating the bean and then creating a singleton bean instantiation, and finally initializing the bean to the system

In short, we typically use the application context to inject and load the bean when the spring load is started . The principle of implementation is also a simple environment for encapsulating contexts, which can then be instantiated using the injected bean

What are the 8.Spring common configuration injections

Bean, service, autowired, transactional, reqyestmapping, Configuration

the role of 9.newRelic monitoring

Monitor business logic for unusual problems.

The difference between IO and NIO

IO is a stream and is blocked, generally used to read and write files, apply to inputstream,ouputstream Read and write, apply to single-threaded operation

Nio is a non-blocking cache that is generally applicable to network file transfers, which can be re-initiated when a disconnection occurs.

11. Character encoding UTF8 is how many bytes

1-4 bytes, this class needs to distinguish between numbers, English, special symbols, kanji and so on.

Java Polygon Question collection

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.