java併發編程概念

線程的四種狀態線程

1.新建 2.就緒,3,死亡4.阻塞繼承

創建線程的途徑線程池

1.繼承Thread 2.實現runnable方法

創建線程池的幾種方法vi

ExecutorService executorService = Executors.newCachedThreadPool();阻塞

ExecutorService executorService = Executors.newFixedThreadPool(3);sync

ExecutorService executorService = Executors.newSingleThreadExecutor();new

加鎖的方式synchronized

synchronized關鍵字 Lock加鎖ab

相關文章
相關標籤/搜索