文档章节

(六)java多线程之ReadWriteLock

天之妖星
 天之妖星
发布于 2017/05/08 14:24
字数 2616
阅读 2
收藏 0

本人邮箱: kco1989@qq.com
欢迎转载,转载请注明网址 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();
                }
            }
        }
    }
}

这里需要注意以下几点
1. 读文件操作比写文件操作频繁,这样才能看到边写边读的效果,这就需要在释放锁的时候,让写线程久一点,让读线程少一点
2. 还有我这里采用判断标记位的方式,让读线程停止操作

  • 最后,我们需要写一个测试类 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<Thread> readThreadList = new ArrayList<>();
        List<ReadRunnable> 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();
        }
    }
}

测试类,需要注意以下几点
1. 创建了三个写操作,

+ 第一个依次写入26个大写字母
+ 第二个依次写入26个小写字母
+ 弟三个依次写入0-9十个数字

2. 创建了五个读操作,让它们不断的读取文件
3. 当全部写操作结束时,这停止这五个读操作

运行程序,结果如下

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: Aa0Bb1Cc2Dd3Ee4Ff5Gg
Thread-7 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg
Thread-5 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg
Thread-6 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg
Thread-2 write 6
Thread-4 read: Aa0Bb1Cc2Dd3Ee4Ff5Gg6
Thread-3 read: Aa0Bb1Cc2Dd3Ee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Ff5Gg6Hh7Ii8Jj9KkLlMmOoOoPpQqRrSsTtUuVvWwXxYyZz

通过运行结果,我们可以发现,读写操作是互不干扰的.每次写操作释放完锁,读操作都可以把之前写的数据全部读取出来.


打赏

如果觉得我的文章写的还过得去的话,有钱就捧个钱场,没钱给我捧个人场(帮我点赞或推荐一下)
微信打赏支付宝打赏

© 著作权归作者所有

天之妖星
粉丝 1
博文 30
码字总数 58258
作品 0
深圳
高级程序员
私信 提问
JDK基础--Java中的锁概念

Java中的锁概念 掌握Java中锁是Java多线程编程中绕不开的知识,只有知道理解Java各种锁才能在编码过程中灵活运用,写出更高效的多线程程序。而理解掌握锁的第一步,可从宏观上对比理解一下各...

spinachgit
04/16
0
0
Java多线程学习(二)synchronized关键字(2)

系列文章传送门: Java多线程学习(一)Java多线程入门 Java多线程学习(二)synchronized关键字(1) java多线程学习(二)synchronized关键字(2) Java多线程学习(三)volatile关键字 Ja...

一只蜗牛呀
2018/04/16
0
0
Java锁有哪些种类,以及区别

一、公平锁/非公平锁 公平锁是指多个线程按照申请锁的顺序来获取锁。 非公平锁是指多个线程获取锁的顺序并不是按照申请锁的顺序,有可能后申请的线程比先申请的线程优先获取锁。有可能,会造...

晨猫
2018/03/23
0
0
Java并发编程之线程安全、线程通信

Java多线程开发中最重要的一点就是线程安全的实现了。所谓Java线程安全,可以简单理解为当多个线程访问同一个共享资源时产生的数据不一致问题。为此,Java提供了一系列方法来解决线程安全问题...

leoliu168
2018/11/07
0
0
Java线程面试题 Top 50

不管你是新程序员还是老手,你一定在面试中遇到过有关线程的问题。Java语言一个重要的特点就是内置了对并发的支持,让Java大受企业和程序员的欢迎。大多数待遇丰厚的Java开发职位都要求开发者...

loda0128
2015/05/29
0
0

没有更多内容

加载失败,请刷新页面

加载更多

聊聊Elasticsearch的CircuitBreakerService

序 本文主要研究一下Elasticsearch的CircuitBreakerService CircuitBreakerService elasticsearch-7.0.1/server/src/main/java/org/elasticsearch/indices/breaker/CircuitBreakerService.ja......

go4it
7分钟前
0
0
Spring系列教程六:AOP详细讲解

AOP 概述 什么是 AOP AOP:全称是 Aspect Oriented Programming 即:面向切面编程。 AOP技术是对OOP技术的一种延伸,AOP是面向纵向,OOP是面向横向。简单的说它就是把我们程序重复的代码抽取...

我叫小糖主
21分钟前
7
0
Qt编写数据可视化大屏界面电子看板9-曲线效果

一、前言 为了编写数据可视化大屏界面电子看板系统,为了能够兼容Qt4和嵌入式linux系统,尤其是那种主频很低的,但是老板又需要在这种硬件上(比如树莓派、香橙派、全志H3、imx6)展示这么华...

飞扬青云
42分钟前
3
0
责任链模式

//这篇博客的博主真的不错,解析的都很清晰明了, https://blog.csdn.net/jason0539/article/details/45091639

南桥北木
今天
3
0
Flutter -------- dio网络请求

dio是Flutter中文网开源的一个强大的Dart Http请求库,支持Restful API、FormData、拦截器、请求取消、Cookie管理、文件上传/下载、超时等... 1.添加依赖# dependencies: dio: 2.1.x #...

切切歆语
今天
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部