java基础知识回顾之java Thread类学习(三)--java线程实现常见的两种方式实现好处:

总结:实现Runnable接口比继承Thread类更有优势:

1.因为java只能单继承,实现Runnable接口可以避免单继承的局限性

2.继承Thread类,多个线程不能处理或者共享同一个资源,但是实现Runnable接口可以处理同一个资源。

下面我们做个测试:验证下。车站的售票系统售票的例子,车站的各个售票口相当于各个线程,我们先使用第一种方法几继承Thread类的方式实现:

代码如下:

package com.lp.ecjtu.Thread;
/**
*
* @author Administrator
* 车站的售票系统售票的例子,车站的各个售票口相当于各个线程。
*
*/
public class TicketsThread extends Thread{
//用静态变量存放这100张票,这样就不会卖重复
private int tickets = 100;
public void run(){
while(true){
if(tickets > 0){
System.out.println(Thread.currentThread().getName()+"***sale***"+(--tickets));
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
// 不合理的买票程序,因为,不同线程都可以卖同一张票,
//现实生活中不是这样的,窗口1买完第99张票,窗口2不可以卖了。
TicketsThread t1 = new TicketsThread();
TicketsThread t2 = new TicketsThread();
TicketsThread t3 = new TicketsThread();
t1.start();
t2.start();
t3.start();
} }

代码的原理图如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA8oAAAHvCAIAAAAD87HPAAAgAElEQVR4nO2de8x0W13fp2mEak1NaEBSm5NiSqBBROot9dZYPR6BHpBwaZWoaFEr1aqoIEcp2yJgS0wjemoIiqJRjLFErEixSk8tlkuxoih4CaKGSrgfeG/P+1xm94953zn73esye/bsvdd3fefzyScn865nz8zaa/Za63t+7zz7XbUAAAAAADARq9IdAAAAAADwoR+v77nnnuhxtNNOO+2000477bTTTvvOdqrXAAAAAACTQbwGAAAAAJgM4jUAAAAAwGQQrwEAAAAAJoN4DQAAAAAwGcRrAAAAAIDJIF4DAAAAAExGP16L3C+Qdtppp5122mmnnXbaa2yneg0AAAAAMBnEawAAAACAySBeAwAAAABMBvHah2a1QpzV0tc4AABABbBf+tCsVm37esSZJF6DH6sY2582TcPjKh7zORo8zn+I1VFx16EH8RpnlXgNfoT796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HBUHBKyi8cXRFlHfKXQJmQTrwEA4Eg5fC8nYSNG3Tdb2wTrDcRrAAA4ag7c10nYiD1H/yq8TcgmXgMAwJEy1V7OV7ERN46+zZRNsN5AvAYAgKOGkI14uJPcv9UmZBOvAQDgSJljLydk47FJsA7pD4fI/QJpp5122mmnfZn2fe97PaSdkI3HYCZYj5tH3PcaAACgbuYumHX+xdPySQhxKuf4p3zNq9cAAABHxQL7+jaOkLaxRoMLeC5sQjbxGgAAjpRSe3kvrCCKu8SkcAnWG4jXAABwpKxibH+a2u95rPaYz9Hgcf5DrI6Kuw4AAHAI4f69aREJHDwe+JjP0eBx6kOslIq7DgAAcAj5Hb144ODxwMd8jgaPidcAAAAOUPX0eMznaPDYPF6L3C+Qdtppp5122uduj+7oO++HTbtaO5+jQXsqXguuG0Pa+ycDAABwJFD19HjM52jw2Lx6DQAAcCRwxwmPx3yOBo+5cwgAAAAAAMQhXgMAAAAATAbxGgAAAABgMojXAAAAAACTQbwGAAAAAJiMfrwWuV8g7bTTTjvttNNOO+2019hO9RoAAAAAYDKI1wAAAAAAk0G8BgAAAACYDOI1AAAAAMBk/H9KgvYt4Gc6GgAAAABJRU5ErkJggg==" alt="" width="811" height="413" />

总结:不合理的卖票方法,不同线程都可以卖同一张票,现实生活中不是这样的,窗口1卖完99号票,窗口2就不可以再卖这张票了。

怎么解决呢?使用实现Runnable接口的方法就可以解决,代码如下:

public class TicketsRunnable implements Runnable {
private int ticket=100;
//Object obj = new Object();
public TicketsRunnable(){
System.out.println("*****************************");
}
@Override
public void run() {
// TODO Auto-generated method stub while(true){
//synchronized(obj){ //同步代码块
if(ticket > 0){//当线程0被调起的时候,当执行到这条判断语句的时候,线程1被调起抢了CPU资源,线程0进入冻结状态。
try {
Thread.sleep(100);//中断当前活跃的线程,或者执行的线程
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName()+"正在卖票"+ticket--);
//System.out.println(Thread.currentThread().getId());
//System.out.println(Thread.currentThread().getName());
}
//} }
} /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TicketsRunnable runna = new TicketsRunnable();
Thread t1 = new Thread(runna);
Thread t2 = new Thread(runna);
Thread t3 = new Thread(runna);
t1.start();
t2.start();
t3.start();
} }

上面代码简单内存图理解如下:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAwgAAAHWCAIAAABczDk2AAAgAElEQVR4nO3d25LjONKsUT26Xmvu/jfTvqgubRYPIMUDEEAst8/aspGUGHQwIB8qG/P6EBEREdHn8/l8Xq0LICIiIooiwYiIiIjoPwlGRERERP9JMCIiIiL6T4IRERER0X8SjIiIiIj+00ow+r//+7/VQ40bN27ceHfj79cL6IjmfeSJERHRUFp8zPwP6IhlTqoswYiIaARJQhiS+glJMCIi6lvyEDJQLR6dPEfz7yAxPPfe6ERD6m+ztP/QAupQ4QPifDBq7g4GRjAiKkskQmYejUeCESIiGBFtSSQC/vBQPBKMEBHBiGhV1l5gxu2fFyf3MdKcq7xer9eaM6uDKPB+vQLuB2PceNtxCy+wylY2qrqPkf5cpRCMvmpeZBd4YkQ0k1UXKHDjp4ZgdCe7T4xko4MIRkRf+aMi4Ah3/cmRYHQnR75KE4yOIBgR/ZHFFviJ6x8fgtGdfIPRLP0IQ78iGBF9rLTAKS5+gghGN/Da0PSA5ZHNy46MYET0sdICpxCMArHMQ1tRCWUEIyLLLHCaKx8igtGd+M/170IwouSyxgIXOf05Yh+jO9l6MrT8kyNRqczbPkbGE49bYIFb2MpG9jGqROFbM1+o/YonRpRWVlfgRk58mghGtzHNPcu/tp4d2bza4AhGlFZWV+BGBKNmfPPQ1t8YzaJS84KDIxhRTllagdv59QNFMLqHcjA6cgCmVAhG79cLKPP0Tbh6WzbvPmAwfu1lwegGXgeeBr3+qnm1XVDhM8k9jDL1s5F7EniIn3pZMLqT3WDUvMJeEIzQnD93SM1s5J4EHkIwasZW+nkt/n9ChKQyghGa871D6mQjNyTwKMcb2T5Gd7IMRrOR778KRmXez+9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VbJiQ9E40vLA5VJGoz6hSETH4hSSNcD1Tjy4bJyxHj7GHUEQ74+RNtvxrjxh8Z1PVCNP8HIPkY9wZCJD0QppOuBapx8YlSzk60IDNn2gSiFdD1QDcGoPxgy8YEohXQ9UA3BqD8YMvGBKIs0PlCBg58sglEsGDLxgSiLND5QAcGoSxgy8YEoizQ+UAHBqEsYMvGBKJH0PvAoxz9W7GMUC4Z8fQi434xx48+N633gUabByD5GPcGQiQ9EuaT9gYf46TNFMIoFQyY+EOWS9gceQjDqGIZMfCBKJysAcDu/fqAIRrFgyMQHonSyAgC3Ixj1DUMmPhBllEUAuJETnyaCUSwYMvGBKKMsAsCNCEbdw5CJD0RJZR0AbuHcR4l9jGLBkK8PzfeVMW684bilALjI6c8RT4xiwZCJD0SpZTUATnPlQ0QwigVDJj4QZZcFATjBxU+Q9sEIM5rfUhEQjIg+ghFwir6DEbCKYET0RxZb4Ceuf3wIRoiIYET0lWfJwBH+dspVCUaIiGBENJNVFyhw46eGYISICEZES1l4gVXu/chovI8RsMrp/SeMGx973NoLzLj988ITI0TEEyOiLfmTI+APd/1R0UyCESIiGBGVJR4hMw9Foj8SjBARwYjoiMQjZOPRSPRHghEiIhgRHZd4hAxUiER/JBghIoIR0a+yez6GZHJjV5JghIgIRkSn5f9lCF2zuIFr63wwAh7l3hudKK2a9zLwE6075uw+RsaNGzdu3Lhx4+ONt49mREREREEkGBERERH9J8GIiIiI6D8JRkRERET/STAiIiIi+k+CEREREdF/+n+oiZKPq++OpwAAAABJRU5ErkJggg==" alt="" />

总结:三个窗口再卖100张票,直到卖完,3个线程才停止。卖的票的号码没有重复,真正实现了现实生活中的卖票的效果。但是存在一个线程安全问题,通过测试运行发现,打印出了0,-1,-2等错票,多线程运行出现了安全问题,这就需要引入线程锁机制,下一篇博客详细的讲解怎样避免这一问题。

 
上一篇:Navicat和SQLyog连接不上MySQL8.x.x数据库解决方案


下一篇:一、JDBC概述