Interview topic: Oppo review

Interview duration: 28 minutes

  1. How does the thread pool work? The meaning of creating thread pool parameters? The function and implementation principle of ArrayBlockingQueue?
    Reference answer:

ArrayBlockingQueue is a blocking queue, inherited from AbstractBlockingQueue, and indirectly implements the Queue interface and the Collection interface. The bottom layer saves data in the form of an array (actually can be regarded as a circular array). Commonly used operations include add, offer, put, remove, poll, take, and peek.

  1. Common collection? How does TreeMap work? CopyOnWriteArrayList principle?
    Reference answer:
name Thread safe description
ArrayList no Inherit the AbstractList class and implement the List, RandomAccess, Cloneable, and Serializable interfaces
Vector Yes Inherit the AbstractList class and implement the List, RandomAccess, Cloneable, and Serializable interfaces
LinkedList no Inherit the AbstractSequentialList class and implement the List, Deque, Cloneable, and Serializable interfaces
HashMap no Inherit the AbstractMap class and implement the Map, Cloneable, and Serializable interfaces
LinkedHashMap no Inherit the HashMap class and implement the Map interface
TreeMap no Inherited the AbstractMap class, and implemented the NavigableMap (inherited SortedMap), Cloneable, and Serializable interfaces
Hashtable Yes Inherit the Dictionary class and implement the Map, Cloneable, and Serializable interfaces
ConcurrentHashMap Yes Inherited the AbstractMap class, and implemented the ConcurrentMap (inherited Map) and Serializable interfaces
HashSet no Inherit the AbstractSet class, and implement the Set, Cloneable, and Serializable interfaces
TreeSet no Inherited the AbstractSet class and implemented the NavigableSet (inherited SortedSet), Cloneable, and Serializable interfaces
LinkedHashSet no Inherit the HashSet class and implement the Set, Cloneable, and Serializable interfaces
CopyOnWriteArrayList Yes Implemented List, RandomAccess, Cloneable, java.io.Serializable
  1. The underlying principle of RPC? How to design a RPC framework

  2. Oracle paging statement? Why do you need to check it once and then do paging?

    select rownum,id,name from ( select rownum rn, n.* from ( select * from test ) n where rownum <=6 ) where rn>=4
    Rownum has the following characteristics:
    1) ROWNUM is only applicable to less than or less than or equal to, if the judgment is equal, then it can only be equal to 1;
    2) ROWNUM is the number of the row allocated by the oracle system sequentially, and the first row returned is allocated 1. The second row is 2, and so on;
    3) ROWNUM always starts from 1
    4) The first data row number is 1, if the condition of >2 is not met, the first row is removed, and the previous second row becomes The new first row, and so on, until the last row, the condition is still not satisfied, so even a piece of data can not be found.

Guess you like

Origin blog.csdn.net/lxn1023143182/article/details/114677979