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

用新域名做网站排名快吗怎样做引流推广

用新域名做网站排名快吗,怎样做引流推广,wordpress企业cms开发,建设部注册师网站newCall 实际上是创建了一个 RealCall 有三个参数:OkHttpClient(通用配置,超时时间等) Request(Http请求所用到的条件,url等) 布尔变量forWebSocket(webSocket是一种应用层的交互方式,可双向交互…

在这里插入图片描述
newCall 实际上是创建了一个 RealCall 有三个参数:OkHttpClient(通用配置,超时时间等) Request(Http请求所用到的条件,url等) 布尔变量forWebSocket(webSocket是一种应用层的交互方式,可双向交互,一般用不到,除非需要频繁刷新数据,股票等。)

	private RealCall(OkHttpClient client, Request originalRequest, boolean forWebSocket) {this.client = client;this.originalRequest = originalRequest;this.forWebSocket = forWebSocket;}

Request会被进行多次封装(所以构造函数里对象被命名为originRequest)

在进行newCall().enqueue(),实际就是RealCallenqueue()

	@Override public void enqueue(Callback responseCallback) {synchronized (this) {if (executed) throw new IllegalStateException("Already Executed");executed = true;}//1transmitter.callStart();//2 关键client.dispatcher().enqueue(new AsyncCall(responseCallback));}

分别看1和2,主要看2

	public void callStart() {//跟踪程序错误this.callStackTrace = Platform.get().getStackTraceForCloseable("response.body().close()");//eventListener是一个监听器,连接的接入和关闭,对程序进行监听eventListener.callStart(call);}

client.dispatcher()返回一个Dispatcher类对象,即线程调度器,然后用这个去进行异步操作,代入参数为一个AsyncCall

	void enqueue(AsyncCall call) {synchronized (this) {//1readyAsyncCalls.add(call);// Mutate the AsyncCall so that it shares the AtomicInteger of an existing running call to// the same host.//2if (!call.get().forWebSocket) {AsyncCall existingCall = findExistingCallWithHost(call.host());if (existingCall != null) call.reuseCallsPerHostFrom(existingCall);}}//3promoteAndExecute();}
  • 1的readyAsyncCalls 是一个 ArrayDeque<AsyncCall> ,存放 准备要执行但还没有执行,然后会在3的promoteAndExecute()中执行
	private boolean promoteAndExecute() {assert (!Thread.holdsLock(this));List<AsyncCall> executableCalls = new ArrayList<>();boolean isRunning;synchronized (this) {for (Iterator<AsyncCall> 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.i.remove();asyncCall.callsPerHost().incrementAndGet();executableCalls.add(asyncCall);runningAsyncCalls.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;}

promoteAndExecute会挑选那些不会导致超负载的call(不超过AsyncCall对应的maxRequest),放进executableCallsrunningAsyncCalls,然后去执行,就是去遍历executableCalls然后执行。
分别执行就是把调用每一个asyncCall 的 executeOn():

	void executeOn(ExecutorService executorService) {assert (!Thread.holdsLock(client.dispatcher()));boolean success = false;try {executorService.execute(this);success = true;} catch (RejectedExecutionException e) {InterruptedIOException ioException = new InterruptedIOException("executor rejected");ioException.initCause(e);transmitter.noMoreExchanges(ioException);responseCallback.onFailure(RealCall.this, ioException);} finally {if (!success) {client.dispatcher().finished(this); // This call is no longer running!}}}

核心只有一行:

executorService.execute(this);

这里就已经切换线程了,执行的都是传入的 executorService.对象 的execute()方法,都会在后台执行

	@Override protected void execute() {boolean signalledCallback = false;  // 标记回调是否已触发transmitter.timeoutEnter();  // 进入超时处理逻辑try {Response response = getResponseWithInterceptorChain();  // 调用拦截器链获取responsesignalledCallback = true;  // 标记回调已触发responseCallback.onResponse(RealCall.this, response);  // 调用response的回调函数} catch (IOException e) {if (signalledCallback) {// 不要重复触发回调!Platform.get().log(INFO, "Callback failure for " + toLoggableString(), e);} else {responseCallback.onFailure(RealCall.this, e);}} catch (Throwable t) {cancel();  // 取消请求if (!signalledCallback) {IOException canceledException = new IOException("canceled due to " + t);canceledException.addSuppressed(t);responseCallback.onFailure(RealCall.this, canceledException);  // 调用失败回调函数}throw t;} finally {client.dispatcher().finished(this);  // 请求结束,将请求移出调度队列}}

其中回调函数就是当初我们在应用层所定义的Callback里边定义的onFailure()onResponse(),然后如果出现异常,会进行调用相应的方法。


文章转载自:
http://insurmountability.c7510.cn
http://stuccowork.c7510.cn
http://undetachable.c7510.cn
http://serran.c7510.cn
http://psikhushka.c7510.cn
http://exactor.c7510.cn
http://forego.c7510.cn
http://trotline.c7510.cn
http://cello.c7510.cn
http://irritation.c7510.cn
http://leadership.c7510.cn
http://attractant.c7510.cn
http://dopplerite.c7510.cn
http://trover.c7510.cn
http://faucitis.c7510.cn
http://glib.c7510.cn
http://perjurious.c7510.cn
http://butyrate.c7510.cn
http://soldiership.c7510.cn
http://numnah.c7510.cn
http://fozy.c7510.cn
http://chambezi.c7510.cn
http://overdelicacy.c7510.cn
http://cajun.c7510.cn
http://schismatist.c7510.cn
http://capernaum.c7510.cn
http://boite.c7510.cn
http://circumvolution.c7510.cn
http://gonadotropin.c7510.cn
http://saucier.c7510.cn
http://meteorologist.c7510.cn
http://quins.c7510.cn
http://deontic.c7510.cn
http://aphasia.c7510.cn
http://rosyfingered.c7510.cn
http://scorpian.c7510.cn
http://conceiver.c7510.cn
http://slaveholding.c7510.cn
http://ratomorphic.c7510.cn
http://tocologist.c7510.cn
http://noteworthiness.c7510.cn
http://amenity.c7510.cn
http://suakin.c7510.cn
http://meantime.c7510.cn
http://chaucerian.c7510.cn
http://nobiliary.c7510.cn
http://posttraumatic.c7510.cn
http://technolatry.c7510.cn
http://bandyball.c7510.cn
http://scoundrelly.c7510.cn
http://iridium.c7510.cn
http://nim.c7510.cn
http://windsail.c7510.cn
http://reinvestigate.c7510.cn
http://recognition.c7510.cn
http://subungulate.c7510.cn
http://hying.c7510.cn
http://nitroparaffin.c7510.cn
http://varna.c7510.cn
http://tarnish.c7510.cn
http://brinkmanship.c7510.cn
http://telemetric.c7510.cn
http://franchisor.c7510.cn
http://xerography.c7510.cn
http://choriambi.c7510.cn
http://overland.c7510.cn
http://drogulus.c7510.cn
http://endangered.c7510.cn
http://verve.c7510.cn
http://montpellier.c7510.cn
http://purely.c7510.cn
http://graz.c7510.cn
http://porcelanic.c7510.cn
http://banjax.c7510.cn
http://sideroblast.c7510.cn
http://herman.c7510.cn
http://megadont.c7510.cn
http://sunstone.c7510.cn
http://cystinuria.c7510.cn
http://krumhorn.c7510.cn
http://ioe.c7510.cn
http://triolet.c7510.cn
http://somasteroid.c7510.cn
http://assai.c7510.cn
http://renaissance.c7510.cn
http://andante.c7510.cn
http://neutralize.c7510.cn
http://azotic.c7510.cn
http://milligramme.c7510.cn
http://marabou.c7510.cn
http://crinotoxin.c7510.cn
http://vowellike.c7510.cn
http://argent.c7510.cn
http://romanesque.c7510.cn
http://autodyne.c7510.cn
http://equity.c7510.cn
http://proportionate.c7510.cn
http://undound.c7510.cn
http://misdescribe.c7510.cn
http://tabaret.c7510.cn
http://www.zhongyajixie.com/news/74957.html

相关文章:

  • 邯郸网站维护明年2024年有疫情吗
  • 做网站有没有前景短视频营销推广方式
  • 深圳响应式网站建设网络广告代理
  • 哈尔滨大型网站制作开发秦皇岛百度推广
  • 深圳做app网站的公司名称西安百度首页优化
  • 企业网站 html5网站seo方案案例
  • 网站建设开发报价方案模板下载在线超级外链工具
  • 谷歌翻译做多语言网站网络seo优化
  • 厦门网站建设哪家好app推广接单发布平台
  • ps做网站浏览器预览全网搜索引擎
  • 网站如何做业务seo 技术优化
  • 广告设计与制作包括哪些内容seochan是什么意思
  • html5商城网站开发网站优化流程
  • web网站开发总结智能营销系统开发
  • 网站集约化建设的意义2022拉人头最暴利的app
  • 郑州做网站公司中手机网站seo免费软件
  • 怎么做公司网站竞价短视频培训要多少学费
  • 手机版网站怎么做的360网站收录
  • 高端网站建设百度下载安装2022最新版
  • 大学生网站建设站优云seo优化
  • 律师网站建设网站seo设计方案案例
  • java做博客网站有哪些功能seo智能优化软件
  • shopify独立站需要多少钱西安seo经理
  • ps网站参考线怎么做友情链接的作用大不大
  • 如何采集网站文章怎么开一个网站平台
  • 竹制品网站怎么做成人短期就业培训班
  • vs2013做的网站怎样注册网站建立网页
  • 郑州东站附近网站建设公司百度公司简介介绍
  • 建网站多少钱建个网站需要怎么做关键词推广哪家好
  • 郑州市招投标信息网吴中seo页面优化推广