20201024 happy holidays

Let’s not talk about those who are happy or not. Seeing that there is a music festival in West Lake, I want to go for a walk, click in and see that there are no tickets.

Today the whole world is celebrating for programmers, and I want to celebrate too, hahaha... @_@

What's next? >>>>>>>>>Talk about the interview

Supplementary tips: Ask why I didn't write it well, because I was lazy, so I finished it the next day; thank you, the big guy in the link, hold your fist! ! !

first-part

1. Have you used multithreading? How to get the return value implemented by the thread?

  •    new ThreadPoolExecutor(int coorPoolSize,int maximumPoolSize,long keepAliveTime, TimeUnit unit,new LinkedBlockedQueue<Runnable> queue,
                            ThreadFactory threadFactory, RejectedExecutionHandler handler)
  • Execution order: (the number of core threads is not full, the core threads execute; the core threads are full, the queue is waiting; the queue is full, enter the maximum number of threads; the maximum number of threads is not full, execute; the maximum number of threads is full, execute the rejection strategy)
  • Rejection strategy

              AbortPolicy : The default test policy, throws RejectedExecutionException runtime exception;

              CallerRunsPolicy : This provides a simple feedback control mechanism that can slow down the submission of new tasks;

              DiscardPolicy : directly discard the newly submitted task;

              DiscardOldestPolicy : If the executor is not closed, the task at the head of the queue will be discarded, and the executor will try to execute the task again (if it fails, repeat the process);

  • callable()

2. Mybatis realizes the paging plug-in

3. List sorting?

  • sort() function;
  • treeSet can also be implemented;

4. How to use stream?

  • Sequence flow: filter(), map()-one-dimensional, flatMap()-two-dimensional, distinct(), sorted(), groupingBy()
  • Parallel stream: parallelStream()

5. What is the difference between memory overflow and memory leak?

  • Memory overflow: not enough memory required (eg: install CSDN application)
  • Memory leak: resource usage leads to system crash

6. Spring's AOP aspect usage, realization and principle?

  •  In terms of definition, some functions that have nothing to do with the business but want to increase in multiple places are abstracted and called to achieve decoupling.
  •  https://www.cnblogs.com/wangshen31/p/9379197.html     eg: log (you can see the reference or the return result)
  •  jdk dynamic proxy, ciglab dynamic proxy

7. SpringBean life cycle?

  • Instantiate
  • Attribute assignment
  • initialization
  • destroy

8. Spring transaction? Isolation level?

  • Four characteristics: atomicity, consistency, isolation, and durability
  • Propagation mechanism: 7 types: REQUIRED (if there is no transaction at present, build; yes, join), REQUIRES_NEW (new, suspend current if there is currently), SUPPORTS (support current, if not currently executed as non-transactional), NOT_SUPPORTED (with Non-transactional execution, currently suspended), MANDATORY (support current, no exceptions thrown), NEVER (non-transactional execution, suspended)
  • Isolation level: read uncommitted (cause dirty read, non-repeatable read, phantom read); read committed (cause non-repeatable read, phantom read); repeatable read (cause phantom read); serializable (very good, that is Will reduce efficiency)

9. How to ensure that the rabbitMq is down?

    Persist data

  •   Set the exchange (channel.exchangeDeclare(exchangeName, "direct/topic/header/fanout", true); that is, set the durable field to true .)
  •   Queue (Queue.DeclareOk queueDeclare(String queue, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) throws IOException; that is, the durable field can be set to true )
  •   message(public BasicProperties( String contentType,//Message type such as: text/plain String contentEncoding,//Encoding Map<String,Object> headers, Integer deliveryMode,//1:nonpersistent 2:persistent Integer priority,//Priority String correlationId, String replyTo,//Feedback queue String expiration,//Expiration expiration time String messageId, Date timestamp, String type, String userId, String appId, String clusterId))

 

 

Guess you like

Origin blog.csdn.net/ningmeng718/article/details/109264866