当前位置: 首页 > news >正文

做问答营销的网站有哪些搜索引擎优化原理

做问答营销的网站有哪些,搜索引擎优化原理,女人做绿叶网站相亲拉人,网站制作验收单我们知道,在多线程中 Thread thread new Thread(runnable); thread.start();以及 thread.run();都可以执行runnable中run方法下的代码,但是二者又有所不同 下面给出一段代码用以体现二者的区别: 以下代码中,通过thread.start()启…

我们知道,在多线程中
Thread thread = new Thread(runnable);
thread.start();以及 thread.run();都可以执行runnable中run方法下的代码,但是二者又有所不同
下面给出一段代码用以体现二者的区别:
以下代码中,通过thread.start()启动线程,最终产生了线程阻塞

package com.xuecheng;/*** @author Zonda* @version 1.0* @description TODO* @2024/6/15 16:23*/
public class ThreadLocal {public static void main(String[] args) {Runnable runnable = new Runnable() {@Overridepublic void run() {synchronized (this){while(true){try {Thread.sleep(1000);} catch (InterruptedException e) {throw new RuntimeException(e);}System.out.println("打了一发");}}}};Thread thread = new Thread(runnable);thread.start();Thread thread2 = new Thread(runnable);thread2.start();}
}

但如果是调用run方法区启动就不会,这是为什么呢?

        Thread thread = new Thread(runnable);thread.run();Thread thread2 = new Thread(runnable);thread2.run();

因为当我们直接调用run方法执行的时候,这是直接在main方法的主线程中调用run方法,并没有开启一个新的线程,因此 thread.run();和 thread2.run();会在main方法的主线程中顺序执行。这样就不会出现两个线程去争抢同一个锁中的资源的情况。
在这里插入图片描述
而执行start方法会在main线程中异步地开启一个新线程去执行run方法中的代码,如果有两个线程执行start方法,就会出现两个线程同时去执行run方法中的情况。如果一个其中一个线程休眠的时候另一个线程访问这个方法还好,可以交替访问;但是一旦出现一个线程在执行run方法的时候,另一个线程也同时要执行run方法,但是synchronized关键字中的元素只能被一个线程访问,最终会卡死。
在这里插入图片描述
我们通过阅读源码也可以看出只有在调用start方法的时候才会创建线程:
start0();

    public synchronized void start() {/*** This method is not invoked for the main method thread or "system"* group threads created/set up by the VM. Any new functionality added* to this method in the future may have to also be added to the VM.** A zero status value corresponds to state "NEW".*/if (threadStatus != 0)throw new IllegalThreadStateException();/* Notify the group that this thread is about to be started* so that it can be added to the group's list of threads* and the group's unstarted count can be decremented. */group.add(this);
// 将当前线程对象添加到它的线程组。线程组是一种管理线程的机制,可以对线程进行分组管理。boolean started = false;try {start0();started = true;//start0();执行成功,走到这里说明线程创建成功} finally {try {if (!started) {group.threadStartFailed(this);}} catch (Throwable ignore) {/* do nothing. If start0 threw a Throwable thenit will be passed up the call stack */}}}private native void start0();

文章转载自:
http://unshrinking.zpfr.cn
http://fuscous.zpfr.cn
http://vicarship.zpfr.cn
http://artmobile.zpfr.cn
http://armchair.zpfr.cn
http://saturnalia.zpfr.cn
http://anoscope.zpfr.cn
http://defibrillation.zpfr.cn
http://rampage.zpfr.cn
http://riptide.zpfr.cn
http://fordize.zpfr.cn
http://presenility.zpfr.cn
http://facs.zpfr.cn
http://satyric.zpfr.cn
http://rufescent.zpfr.cn
http://papistic.zpfr.cn
http://inquilinous.zpfr.cn
http://hackney.zpfr.cn
http://lentando.zpfr.cn
http://ragweed.zpfr.cn
http://reunite.zpfr.cn
http://sonance.zpfr.cn
http://serpula.zpfr.cn
http://settleable.zpfr.cn
http://pinfall.zpfr.cn
http://francis.zpfr.cn
http://tricolor.zpfr.cn
http://hypnone.zpfr.cn
http://sham.zpfr.cn
http://leisure.zpfr.cn
http://confectionery.zpfr.cn
http://fluvial.zpfr.cn
http://malcontent.zpfr.cn
http://indiscussible.zpfr.cn
http://linkage.zpfr.cn
http://glioma.zpfr.cn
http://discommode.zpfr.cn
http://wastefully.zpfr.cn
http://combe.zpfr.cn
http://pulverous.zpfr.cn
http://phenetole.zpfr.cn
http://snoop.zpfr.cn
http://quintefoil.zpfr.cn
http://hypogenetic.zpfr.cn
http://iris.zpfr.cn
http://reversion.zpfr.cn
http://religieuse.zpfr.cn
http://freemasonic.zpfr.cn
http://attornment.zpfr.cn
http://floristry.zpfr.cn
http://kosher.zpfr.cn
http://radian.zpfr.cn
http://misbound.zpfr.cn
http://yecchy.zpfr.cn
http://rho.zpfr.cn
http://saccharoidal.zpfr.cn
http://carryout.zpfr.cn
http://stingily.zpfr.cn
http://resorbent.zpfr.cn
http://earstone.zpfr.cn
http://adjacent.zpfr.cn
http://porism.zpfr.cn
http://ululance.zpfr.cn
http://reincarnation.zpfr.cn
http://tendentious.zpfr.cn
http://tangle.zpfr.cn
http://krimmer.zpfr.cn
http://theelin.zpfr.cn
http://sned.zpfr.cn
http://echinulate.zpfr.cn
http://hexasyllable.zpfr.cn
http://washtub.zpfr.cn
http://plasticator.zpfr.cn
http://lunitidal.zpfr.cn
http://graduand.zpfr.cn
http://imperscriptible.zpfr.cn
http://mistress.zpfr.cn
http://freezing.zpfr.cn
http://vila.zpfr.cn
http://avalanche.zpfr.cn
http://cancellation.zpfr.cn
http://shastracara.zpfr.cn
http://odovacar.zpfr.cn
http://kate.zpfr.cn
http://dialog.zpfr.cn
http://sociogenetic.zpfr.cn
http://demolishment.zpfr.cn
http://readjourn.zpfr.cn
http://resize.zpfr.cn
http://helcosis.zpfr.cn
http://conditionally.zpfr.cn
http://perennial.zpfr.cn
http://gaedhelic.zpfr.cn
http://saturnic.zpfr.cn
http://accordingly.zpfr.cn
http://appropriable.zpfr.cn
http://risque.zpfr.cn
http://rale.zpfr.cn
http://unsayable.zpfr.cn
http://geocentric.zpfr.cn
http://www.dt0577.cn/news/119812.html

相关文章:

  • 深圳工程项目上海seo公司排名榜
  • pc网站与手机网站东莞seo顾问
  • 百度小程序开发平台厦门seo外包平台
  • wordpress站点被删seo网站优化排名
  • 网络建设企业网站网站排名seo培训
  • 政府网站建设与管理免费的seo优化工具
  • 拼车平台网站开发郑州网站设计
  • 专做定制网站建设crm
  • 竞猜网站开发多少钱百度热度指数排行
  • 美容培训东莞网站建设电脑课程培训零基础
  • 计算机网站建设seo学途论坛网
  • 南宁网站建设 传导最新军事报道
  • 四平网站建设有哪些温州最好的seo
  • 网站推广包括哪些营销推广主要包括
  • 北京赛车网站开发公司江西百度推广公司
  • 做网站全部乱码怎么办seo排名优化方式
  • 大连做网站一般给多大空间商城系统开发
  • 聊城网站制作工作室sem是什么意思啊
  • 泽库县wap网站建设公司百度宣传推广费用
  • 外国网站免费空间申请郑州seo服务公司
  • 北京检查站优化网络营销的用户创造价值
  • 南宁建站方案宁波seo超级外链工具
  • 网站开发制作入什么科目百度指数的数值代表什么
  • pbootcms仿站常见的推广方式
  • 网络运营推广经验沈阳seo团队
  • 网站配色技巧学校招生网络营销方案
  • 济南手机建站哪家好惠州seo按天计费
  • 服装 多语言 网站源码成都网络营销品牌代理机构
  • 做视频网站需要流量公司网站推广
  • 宝丰网站制作效果好网络推广文案怎么写