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

欧美风格网站源码泰兴网站推广做网站

欧美风格网站源码,泰兴网站推广做网站,seo发展现状,wordpress的分类目录一、定义 Exchanger是一个用于线程间数据交换的工具类#xff0c;它提供一个公共点#xff0c;在这个公共点#xff0c;两个线程可以交换彼此的数据。 当一个线程调用exchange方法后将进入等待状态#xff0c;直到另外一个线程调用exchange方法#xff0c;双方完成数据交换…一、定义 Exchanger是一个用于线程间数据交换的工具类它提供一个公共点在这个公共点两个线程可以交换彼此的数据。 当一个线程调用exchange方法后将进入等待状态直到另外一个线程调用exchange方法双方完成数据交换后继续执行。 Exchanger 是 JDK 1.5 开始提供的一个用于两个工作线程之间交换数据的封装工具类简单说就是一个线程在完成一定的事务后想与另一个线程交换数据则第一个先拿出数据的线程会一直等待第二个线程直到第二个线程拿着数据到来时才能彼此交换对应数据。 从定义来看Exchanger是用于线程间进行通信、数据交换。Exchanger提供了一个同步点exchange方法两个线程调用exchange方法时无论调用时间先后两个线程会互相等到线程到达exchange方法调用点此时两个线程可以交换数据将本线程产出数据传递给对方。 /*** Waits for another thread to arrive at this exchange point (unless* the current thread is {linkplain Thread#interrupt interrupted}),* and then transfers the given object to it, receiving its object* in return.** pIf another thread is already waiting at the exchange point then* it is resumed for thread scheduling purposes and receives the object* passed in by the current thread. The current thread returns immediately,* receiving the object passed to the exchange by that other thread.** pIf no other thread is already waiting at the exchange then the* current thread is disabled for thread scheduling purposes and lies* dormant until one of two things happens:* ul* liSome other thread enters the exchange; or* liSome other thread {linkplain Thread#interrupt interrupts}* the current thread.* /ul* pIf the current thread:* ul* lihas its interrupted status set on entry to this method; or* liis {linkplain Thread#interrupt interrupted} while waiting* for the exchange,* /ul* then {link InterruptedException} is thrown and the current threads* interrupted status is cleared.** param x the object to exchange* return the object provided by the other thread* throws InterruptedException if the current thread was* interrupted while waiting*/SuppressWarnings(unchecked)public V exchange(V x) throws InterruptedException {Object v;Object item (x null) ? NULL_ITEM : x; // translate null argsif ((arena ! null ||(v slotExchange(item, false, 0L)) null) ((Thread.interrupted() || // disambiguates null return(v arenaExchange(item, false, 0L)) null)))throw new InterruptedException();return (v NULL_ITEM) ? null : (V)v;}/*** Waits for another thread to arrive at this exchange point (unless* the current thread is {linkplain Thread#interrupt interrupted} or* the specified waiting time elapses), and then transfers the given* object to it, receiving its object in return.** pIf another thread is already waiting at the exchange point then* it is resumed for thread scheduling purposes and receives the object* passed in by the current thread. The current thread returns immediately,* receiving the object passed to the exchange by that other thread.** pIf no other thread is already waiting at the exchange then the* current thread is disabled for thread scheduling purposes and lies* dormant until one of three things happens:* ul* liSome other thread enters the exchange; or* liSome other thread {linkplain Thread#interrupt interrupts}* the current thread; or* liThe specified waiting time elapses.* /ul* pIf the current thread:* ul* lihas its interrupted status set on entry to this method; or* liis {linkplain Thread#interrupt interrupted} while waiting* for the exchange,* /ul* then {link InterruptedException} is thrown and the current threads* interrupted status is cleared.** pIf the specified waiting time elapses then {link* TimeoutException} is thrown. If the time is less than or equal* to zero, the method will not wait at all.** param x the object to exchange* param timeout the maximum time to wait* param unit the time unit of the {code timeout} argument* return the object provided by the other thread* throws InterruptedException if the current thread was* interrupted while waiting* throws TimeoutException if the specified waiting time elapses* before another thread enters the exchange*/SuppressWarnings(unchecked)public V exchange(V x, long timeout, TimeUnit unit)throws InterruptedException, TimeoutException {Object v;Object item (x null) ? NULL_ITEM : x;long ns unit.toNanos(timeout);if ((arena ! null ||(v slotExchange(item, true, ns)) null) ((Thread.interrupted() ||(v arenaExchange(item, true, ns)) null)))throw new InterruptedException();if (v TIMED_OUT)throw new TimeoutException();return (v NULL_ITEM) ? null : (V)v;}V exchange(V v)等待另一个线程到达此交换点除非当前线程被中断然后将给定的对象传送给该线程并接收该线程的对象。 V exchange(V v, long timeout, TimeUnit unit)等待另一个线程到达此交换点或者当前线程被中断——抛出中断异常又或者是等候超时——抛出超时异常然后将给定的对象传送给该线程并接收该线程的对象。
http://wiki.neutronadmin.com/news/224332/

相关文章:

  • 设计比较有特色的网站哈尔滨百度推广排名优化
  • 什么样的公司愿意做网站软文撰写公司
  • 网站空间国外那个好外贸网站建设 东莞
  • 厦门中小企业建网站补助黄页网络的推广
  • 郑州网站建设亻汉狮网络网络营销渠道管理
  • 企业网站制作深圳鞋行业的网站建设
  • 娄底高端网站建设wordpress 修改端口
  • 锡林浩特市长安网站 建设初步方案网页浏览器设置在哪里
  • 赣州网站制作公司百度有专做优化的没
  • 佛山网站建设全方位服务汽车之家网址
  • 贵港网站推广网络营销和网站推广的区别
  • 长安网站建设价格宝安专业网站设计公司
  • 网站宽屏背景网站运营托管协议
  • 网站建设对接模版网站划分栏目
  • 网站名 注册报告怎么写
  • 做网站卖广告位赚钱html5 jq做电脑网站
  • 网站开发公司有哪些椒江街道招聘建设网站
  • 酒店网站建设注意什么网页设计与制作工资
  • 网页特效网站建筑材料东莞网站建设
  • 成都网站制作汕头做网站用什么系统较好
  • 甘肃省住房城乡建设厅网站公司网络营销
  • 爱站网ip反查域名网站新闻源码
  • 实验室网站建设的调查报告建设网站有哪些
  • 网站建好以后每年都续费么用word怎么做网站
  • 首都医科大学网站建设凡科电脑版
  • 宁夏众擎达网站建设成都企业网站优化
  • 手表常用网站人工智能绘画
  • wordpress建站 评测苏州网站建设功能
  • 网站后台管理系统html下载湖南网站制作公司
  • 凡科建站登录官网陈村大良网站建设