Superfine interview (demons nowhere to hide, a half-hour interview with)

  • Draw the thread of the life cycle, and lists ways to create threads

    Five states thread: New (New), Ready (Runnable), running (Running), blocked (Blocked), death (Dead) 
    
    created: inheritance Thread achieve Runnable achieve Callable using Executors

    problem:
      End 1. sleep after enter what state?
      2. Runnable and Callable difference?
      3. FutureTask is what
      several thread pools 4. Executors created? ThreadPoolExecutor parameters?
      

     

  • Please describe Synchuronized keyword lists his usual lock. Please Miao Xu about the difference between the Volatile and Synchronized.
      Java virtual machine synchronization (Synchronization) Based enter and exit the tube (Monitor) object implements 
    
      ReentrantLock 

    difference:
    • volatile nature is telling jvm current variable values ​​in register (working memory) is uncertain, needs to be read from the main memory; synchronized current variable is locked, only the current thread can access the variables, other threads are blocked live .
    • volatile level can only be used in a variable; the synchronized variables can be used in the methods, and the class level
    • Modify visibility and atomicity is guaranteed and synchronized variables; volatile visibility can be achieved only modify variables, does not guarantee atomicity
    • volatile will not cause obstruction thread; synchronized may cause obstruction thread.
    • volatile variables are not labeled optimizing compiler; mark may be synchronized variable optimizing compiler

     

      Problem extends:

       ReentrantLock and Synchuronized What is the difference?

     

     

  • spring in the bean life cycle and scope
        Spring Bean life cycle is complex, can be divided into two processes are created and destroyed, the details of their own Baidu.

  

 

 

  •   spring注解@Autowired,@Resource,@Qualifier
    @Autowired strategy adopted is in accordance with the type of injection (ByType).
      public class UserService {
        @Autowired
        private UserDao userDao; 
    }

    When a bean type has several values, it will result in a situation which can not select specific injection, this time we need to meet the @Qualifier use. @Qualifier tell which objects specific to spring assembly.
    public class UserService {
        @Autowired
        @Qualifier(name="userDao1")    
        private UserDao userDao; 
    }

    @Resource default automatically injected in accordance with ByName.
    public class UserService {
        @Resource  
        private UserDao userDao; 
        @Resource(name="studentDao")  
        private StudentDao studentDao; 
        @Resource(type="TeacherDao")  
        private TeacherDao teacherDao; 
        @Resource(name="manDao",type="ManDao")  
        private ManDao manDao; 
    } 

      ①如果同时指定了name和type,则从Spring上下文中找到唯一匹配的bean进行装配,找不到则抛出异常。

      ②如果指定了name,则从上下文中查找名称(id)匹配的bean进行装配,找不到则抛出异常。

      ③如果指定了type,则从上下文中找到类似匹配的唯一bean进行装配,找不到或是找到多个,都会抛出异常。

      ④如果既没有指定name,又没有指定type,则自动按照byName方式进行装配;如果没有匹配,则回退为一个原始类型进行匹配,如果匹配则自动装配。



     

  • 什么是事务?并发事务会引发什么问题? 列出事务隔离级别
    问题延伸:
        1.事务的底层:aop
        2.aop的底层: 动态代理
        3.spring提供了哪几种动态代理?
        4.@Transaction的默认传播行为
        5.一个用@Transaction的方法调用另一个用了@Transaction的方法,执行几次事务,怎么做能只执行一次事务
        6.try catch包裹是否能让transaction无效(差不多这个意思)

     

  • JVM内存模型,并描叙各自的作用
    说这是基本,就几个,肯定要知道(显而易见 我不会)


     

  • 快速排序 
  • 手写单例模式并调优
  • 设计秒杀系统的架构图
  • redis的持久化RDB和AOF
  • Hashmap底层和1.8之后的改变,什么是红黑树。
    实话实说,  我游戏网名:Java开发攻城狮  ,就总有人给我出问题,就有人问过我hashmap为什么起用红黑树

     

  • springMVC的流程
    建议就俗一点按网上的答,不然他会问你底层源码,handleMapping怎么做的,handleAdapter又怎么做的,没看过源码,老实闭嘴等下个问题。

     

 

 

Guess you like

Origin www.cnblogs.com/ityangshuai/p/11937624.html