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

做解析会员电影的网站电子商城网站如何建设

做解析会员电影的网站,电子商城网站如何建设,软件开发费用一览表,手机网站 jquery 特效1.正在执行的任务数量最大值是64 异步请求放入readyAsyncCalls后#xff0c;遍历readyAsyncCalls取出任务去执行的时候#xff0c;如果发现runningAsyncCalls的数量大于等于64#xff0c;就不从readyAsyncCalls取出任务执行。 public final class Dispatcher {private int …1.正在执行的任务数量最大值是64 异步请求放入readyAsyncCalls后遍历readyAsyncCalls取出任务去执行的时候如果发现runningAsyncCalls的数量大于等于64就不从readyAsyncCalls取出任务执行。 public final class Dispatcher {private int maxRequests 64;private final DequeAsyncCall runningAsyncCalls new ArrayDeque();private boolean promoteAndExecute() {assert (!Thread.holdsLock(this));ListAsyncCall executableCalls new ArrayList();boolean isRunning;synchronized (this) {for (IteratorAsyncCall i readyAsyncCalls.iterator(); i.hasNext(); ) {AsyncCall asyncCall i.next();//如果超过了最大数目if (runningAsyncCalls.size() maxRequests) break; // Max capacity.if (asyncCall.callsPerHost().get() maxRequestsPerHost) continue; // Host max capacity.//从readyAsyncCalls removei.remove();//callsPerHost1asyncCall.callsPerHost().incrementAndGet();//添加到executableCallsexecutableCalls.add(asyncCall);//添加到runningAsyncCallsrunningAsyncCalls.add(asyncCall);}isRunning runningCallsCount() 0;}for (int i 0, size executableCalls.size(); i size; i) {AsyncCall asyncCall executableCalls.get(i);//执行asyncCall.executeOn(executorService());}return isRunning;} } 2.同一个主机的最大连接数为5 异步请求放入readyAsyncCalls后遍历readyAsyncCalls取出任务去执行的时候如果发现asyncCall的callsPerHost大于等于5就不从readyAsyncCalls取出任务执行否则callsPerHost加1。 public final class Dispatcher {private int maxRequestsPerHost 5; //默认5。这是okhttp对同一主机允许的最大请求数量。void enqueue(AsyncCall call) {synchronized (this) {readyAsyncCalls.add(call);//Mutate the AsyncCall so that it shares the AtomicInteger //of an existing running call to the same host.if (!call.get().forWebSocket) {//从已经存在的任务里面找同一个主机的任务AsyncCall existingCall findExistingCallWithHost(call.host());if (existingCall ! null) {//call的将callsPerHost赋值为existingCall的callsPerHostcall.reuseCallsPerHostFrom(existingCall);}}}promoteAndExecute();}//有个疑问这里是不是要从ArrayDeque尾向前获取才能获取到最新的AsyncCall这样获取到的//callsPerHost才会是最大的//目前从头开始获取是不是有问题//先从runningAsyncCalls找再从readyAsyncCalls找Nullable private AsyncCall findExistingCallWithHost(String host) {for (AsyncCall existingCall : runningAsyncCalls) {if (existingCall.host().equals(host)) {return existingCall;}}for (AsyncCall existingCall : readyAsyncCalls) {if (existingCall.host().equals(host)) {return existingCall;}}return null;} }
http://www.yutouwan.com/news/407045/

相关文章:

  • 网站开发用什么系统兰州程序开发网站建设
  • 仿网站ppt怎么做微信上的网站怎么做的吗
  • 公司做网站自己注册域名论坛推广工具
  • 熊掌号网站改造绑定织梦网站农村电商网站有哪些
  • 大连企业建设网站源码社区
  • 购买天猫店铺网站wordpress密码忘了怎么办
  • 学校网站建设开发方案书昆山网站
  • 做网站行业现状计算机二级网页制作基础
  • 网站建站的步骤东坑网站建设
  • 关于公司做网站供比价报告wordpress银行模板下载
  • 免费行情网站大全做的网站访问速度慢
  • 沈阳个人网站建设代理品牌怎么做公司内部网站
  • 阜新市项目建设网站母婴网站模板dede
  • 做网站推广电话手机app开发培训课程
  • 外贸类网站建设什么专业学网页设计
  • 网站开发ide php大连免费营销型建站网络推广
  • wordpress出现的问题5年网站seo优化公司
  • 开源网站程序建筑模板施工图片
  • 怎样做网站发布信息换网站公司
  • 网站建设及运营工作总结安卓优化大师app下载
  • 网站安全设计系统优化
  • 网站自己做服务器网站建设时间
  • 网站后台密码重置房管家erp中介管理系统
  • 大航母网站建设好不好嘉兴网站制作哪家专业
  • 网站建设时间影响因素嘉兴推广网站
  • 装修设计灵感网站建设社区服务网站的论文
  • 马鞍山做网站公司小说网站建设
  • 网站备案好处可以分为( )
  • 网站建设多少钱鞋网站建设规划大纲
  • 上海网站建设方案咨询网站开发需要用到哪些软件