国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

(六)java多線程之ReadWriteLock

CloudDeveloper / 3392人閱讀

摘要:本人郵箱歡迎轉載轉載請注明網址代碼已經全部托管有需要的同學自行下載引言上一篇講到了在同一個時間點只能用一個線程能夠訪問共享資源今天我們來講一下讀寫鎖讀寫鎖提供了在同一個時間點可以有多個線程共享去讀取共享資源當只有有一個線程去寫共享資源主要是

本人郵箱:
歡迎轉載,轉載請注明網址 http://blog.csdn.net/tianshi_kco
github: https://github.com/kco1989/kco
代碼已經全部托管github有需要的同學自行下載

引言

上一篇講到了ReentrantLock,在同一個時間點,只能用一個線程能夠訪問共享資源.今天我們來講一下讀寫鎖ReadWriteLock,讀寫鎖提供了在同一個時間點,可以有多個線程共享去讀取共享資源,當只有有一個線程去寫共享資源.

ReadWriteLock主要是Lock鎖使用的,提供一個讀和一個寫的操作.readLock可以在有多個線程同時操作直到沒有寫的操作.writeLock卻在同一個時間點只能有一個線程在操作.
所有ReadWriteLock的實現類必須在writeLock寫操作時,保證內存同步,同時還必須和readLock相關聯,比如當一個線程獲取到讀鎖時,這必須保證當前線程能在寫鎖釋放后看到所有的更新操作.

例子

首先定一個模擬讀寫文件的類MockFIle

public class MockFile {

    // 使用StringBuilder而不是使用StringBuffer
    // 是因為StringBuilder是線程不安全的,而StringBuffer是線程安全的
    StringBuilder fileContent;

    public MockFile() {
        this.fileContent = new StringBuilder();
    }

    public String readFile(){
        try {
            Thread.sleep(10);
            String content = fileContent.toString();
            Thread.sleep(10);
            return content;
        } catch (InterruptedException e) {
            return null;
        }
    }

    public void writeFile(char content){
        try {
            Thread.sleep(10);
            fileContent.append(content);
            Thread.sleep(10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

注意在該類使用StringBuilder是因為這個類是線程不安全的
StringBuffer是線程安全的

之后編寫讀文件操作 ReadRunnable

public class ReadRunnable implements Runnable {
    ReadWriteLock lock;
    MockFile file;
    boolean isStop;
    public ReadRunnable(ReadWriteLock lock, MockFile file) {
        this.lock = lock;
        this.file = file;
        isStop = false;
    }

    @Override
    public void run() {
        Thread self = Thread.currentThread();
        while(!isStop){
            Lock lock = this.lock.readLock();
            try {
                lock.lock();
                String content = file.readFile();
                System.out.println(self.getName() + " read: " + content);
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }finally {
                lock.unlock();
                try {
                    Thread.sleep(50);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void setStop() {
        isStop = true;
    }
}

然后再編寫 寫文件操作 WriteRunnable

public class WriteRunnable implements Runnable {
    ReadWriteLock lock;
    MockFile file;
    String content;

    public WriteRunnable(ReadWriteLock lock, MockFile file, String content) {
        this.lock = lock;
        this.file = file;
        this.content = content;
    }

    @Override
    public void run() {
        Thread self = Thread.currentThread();
        for (char ch : content.toCharArray()){
            Lock lock = this.lock.writeLock();
            try {
                lock.lock();
                System.out.println(self.getName() + " write " + ch);
                file.writeFile(ch);
                Thread.sleep(20);
            } catch (InterruptedException e) {
                e.printStackTrace();
            } finally {
                lock.unlock();
                try {
                    Thread.sleep(200);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

這里需要注意以下幾點

讀文件操作比寫文件操作頻繁,這樣才能看到邊寫邊讀的效果,這就需要在釋放鎖的時候,讓寫線程久一點,讓讀線程少一點

還有我這里采用判斷標記位的方式,讓讀線程停止操作

最后,我們需要寫一個測試類 TestMain

public class TestMain {

    public static void main(String[] args) {
        MockFile mockFile = new MockFile();
        ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
        Thread thread1 = new Thread(new WriteRunnable(lock, mockFile, "ABCDEFGHIJKLMOOPQRSTUVWXYZ"));
        Thread thread2 = new Thread(new WriteRunnable(lock, mockFile, "abcdefghijklmoopqrstuvwxyz"));
        Thread thread3 = new Thread(new WriteRunnable(lock, mockFile, "0123456789"));
        List readThreadList = new ArrayList<>();
        List readRunnables = new ArrayList<>();
        for (int i = 0; i < 5; i ++){
            ReadRunnable readRunnable = new ReadRunnable(lock, mockFile);
            readThreadList.add(new Thread(readRunnable));
            readRunnables.add(readRunnable);
        }
        thread1.start();
        thread2.start();
        thread3.start();
        for (Thread readThread : readThreadList){
            readThread.start();
        }

        while (thread1.isAlive() || thread2.isAlive() || thread3.isAlive());

        for (ReadRunnable readRunnable : readRunnables){
            readRunnable.setStop();
        }
    }
}

測試類,需要注意以下幾點

創建了三個寫操作,

+ 第一個依次寫入26個大寫字母
+ 第二個依次寫入26個小寫字母
+ 弟三個依次寫入0-9十個數字

創建了五個讀操作,讓它們不斷的讀取文件

當全部寫操作結束時,這停止這五個讀操作

運行程序,結果如下

Thread-0 write A
Thread-1 write a
Thread-2 write 0
Thread-4 read: Aa0
Thread-5 read: Aa0
Thread-7 read: Aa0
Thread-3 read: Aa0
Thread-6 read: Aa0
Thread-6 read: Aa0
Thread-3 read: Aa0
Thread-4 read: Aa0
Thread-7 read: Aa0
Thread-5 read: Aa0
Thread-0 write B
Thread-6 read: Aa0B
Thread-1 write b
Thread-5 read: Aa0Bb
Thread-3 read: Aa0Bb
Thread-4 read: Aa0Bb
Thread-7 read: Aa0Bb
Thread-2 write 1
Thread-6 read: Aa0Bb1
Thread-5 read: Aa0Bb1
Thread-3 read: Aa0Bb1
Thread-4 read: Aa0Bb1
Thread-7 read: Aa0Bb1
Thread-0 write C
Thread-7 read: Aa0Bb1C
Thread-4 read: Aa0Bb1C
Thread-5 read: Aa0Bb1C
Thread-6 read: Aa0Bb1C
Thread-3 read: Aa0Bb1C
Thread-1 write c
Thread-3 read: Aa0Bb1Cc
Thread-4 read: Aa0Bb1Cc
Thread-7 read: Aa0Bb1Cc
Thread-5 read: Aa0Bb1Cc
Thread-6 read: Aa0Bb1Cc
Thread-2 write 2
Thread-3 read: Aa0Bb1Cc2
Thread-4 read: Aa0Bb1Cc2
Thread-5 read: Aa0Bb1Cc2
Thread-7 read: Aa0Bb1Cc2
Thread-6 read: Aa0Bb1Cc2
Thread-0 write D
Thread-7 read: Aa0Bb1Cc2D
Thread-6 read: Aa0Bb1Cc2D
Thread-3 read: Aa0Bb1Cc2D
Thread-4 read: Aa0Bb1Cc2D
Thread-5 read: Aa0Bb1Cc2D
Thread-1 write d
Thread-2 write 3
Thread-7 read: Aa0Bb1Cc2Dd3
Thread-6 read: Aa0Bb1Cc2Dd3
Thread-3 read: Aa0Bb1Cc2Dd3
Thread-4 read: Aa0Bb1Cc2Dd3
Thread-5 read: Aa0Bb1Cc2Dd3
Thread-0 write E
Thread-3 read: Aa0Bb1Cc2Dd3E
Thread-6 read: Aa0Bb1Cc2Dd3E
Thread-7 read: Aa0Bb1Cc2Dd3E
Thread-4 read: Aa0Bb1Cc2Dd3E
Thread-5 read: Aa0Bb1Cc2Dd3E
Thread-1 write e
Thread-2 write 4
Thread-5 read: Aa0Bb1Cc2Dd3Ee4
Thread-4 read: Aa0Bb1Cc2Dd3Ee4
Thread-7 read: Aa0Bb1Cc2Dd3Ee4
Thread-6 read: Aa0Bb1Cc2Dd3Ee4
Thread-3 read: Aa0Bb1Cc2Dd3Ee4
Thread-0 write F
Thread-1 write f
Thread-2 write 5
Thread-5 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-4 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-7 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-3 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-6 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-7 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-4 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-5 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-6 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-3 read: Aa0Bb1Cc2Dd3Ee4Ff5
Thread-0 write G
Thread-1 write g
Thread-4 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg
Thread-3 read: Aa0Bb1Cc2Dd3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Zz
Thread-5 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7Ii8Jj9KkLlMmOoOoPpQqRrSsTtUuVvWwXxYyZz
Thread-4 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7Ii8Jj9KkLlMmOoOoPpQqRrSsTtUuVvWwXxYyZz
Thread-6 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg6Hh7Ii8Jj9KkLlMmOoOoPpQqRrSsTtUuVvWwXxYyZz

通過運行結果,我們可以發現,讀寫操作是互不干擾的.每次寫操作釋放完鎖,讀操作都可以把之前寫的數據全部讀取出來.

打賞

如果覺得我的文章寫的還過得去的話,有錢就捧個錢場,沒錢給我捧個人場(幫我點贊或推薦一下)

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/67073.html

相關文章

  • Java線程進階(二)—— J.U.Clocks框架:接口

    摘要:二接口簡介可以看做是類的方法的替代品,與配合使用。當線程執行對象的方法時,當前線程會立即釋放鎖,并進入對象的等待區,等待其它線程喚醒或中斷。 showImg(https://segmentfault.com/img/remote/1460000016012601); 本文首發于一世流云的專欄:https://segmentfault.com/blog... 本系列文章中所說的juc-...

    dkzwm 評論0 收藏0
  • Java線程學習()Lock鎖的使用

    摘要:返回與此鎖相關聯的給定條件等待的線程數的估計。查詢是否有線程正在等待獲取此鎖。為公平鎖,為非公平鎖線程運行了獲得鎖定運行結果公平鎖的運行結果是有序的。 系列文章傳送門: Java多線程學習(一)Java多線程入門 Java多線程學習(二)synchronized關鍵字(1) java多線程學習(二)synchronized關鍵字(2) Java多線程學習(三)volatile關鍵字 ...

    Caicloud 評論0 收藏0
  • Java線程進階(四)—— J.U.Clocks框架:ReentrantReadWriteLoc

    摘要:我們知道,的作用其實是對類的和的增強,是為了讓線程在指定對象上等待,是一種線程之間進行協調的工具。當線程調用對象的方法時,必須拿到和這個對象關聯的鎖。 showImg(https://segmentfault.com/img/remote/1460000016012566); 本文首發于一世流云的專欄:https://segmentfault.com/blog... 一、Reentr...

    kumfo 評論0 收藏0
  • [Java并發-10] ReadWriteLock:快速實現一個完備的緩存

    摘要:此時線程和會再有一個線程能夠獲取寫鎖,假設是,如果不采用再次驗證的方式,此時會再次查詢數據庫。而實際上線程已經把緩存的值設置好了,完全沒有必要再次查詢數據庫。 大家知道了Java中使用管程同步原語,理論上可以解決所有的并發問題。那 Java SDK 并發包里為什么還有很多其他的工具類呢?原因很簡單:分場景優化性能,提升易用性 今天我們就介紹一種非常普遍的并發場景:讀多寫少場景。實際工作...

    nevermind 評論0 收藏0
  • 如何使用 Java8 實現觀察者模式?(下)

    摘要:線程安全的實現前面章節介紹了在現代環境下的實現觀察者模式,雖然簡單但很完整,但這一實現忽略了一個關鍵性問題線程安全。截止目前實現了線程安全,在接下來的章節中將介紹提取主題的邏輯并將其類封裝為可重復代碼單元的方式優缺點。 【編者按】本文作者是 BAE 系統公司的軟件工程師 Justin Albano。在本篇文章中,作者通過在 Java8 環境下實現觀察者模式的實例,進一步介紹了什么是觀察...

    afishhhhh 評論0 收藏0
  • Java線程基礎(八)——Read-Write Lock模式

    摘要:二模式案例類數據類可以被多個線程同時訪問。共享資源參與者代表和所共享的資源對象,提供不改變內部狀態的操作,以及會改變內部狀態的操作。讀寫鎖參與者提供了對參與者進行操作和操作時需要的鎖定。 一、定義 Read-Write Lock Pattern將讀取與寫入分開處理,在讀取數據之前必須獲取用來讀取的鎖定,而寫入的時候必須獲取用來寫入的鎖定。因為讀取時實例的狀態不會改變,所以多個線程可...

    snifes 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<