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

响应式网站滑动网站公司建设

响应式网站滑动,网站公司建设,免费云主机永久使用,网站开发自荐信Executor public interface Executor {//执行任务void execute(Runnable command); }ExecutorService public interface ExecutorService extends Executor {//关闭线程池#xff0c;不能再向线程池中提交任务#xff0c;已存在与线程池中的任务会继续执行#xff0c;直到…Executor public interface Executor {//执行任务void execute(Runnable command); }ExecutorService public interface ExecutorService extends Executor {//关闭线程池不能再向线程池中提交任务已存在与线程池中的任务会继续执行直到完成void shutdown();//立刻关闭线程池不能再向线程池中提交任务已存在与线程池中的任务会被终止执行ListRunnable shutdownNow();//判断线程池是否已关闭boolean isShutdown();//判断线程池是否已终止只有调用了shutdown()或shutdownNow()之后该方法才会返回trueboolean isTerminated();//等待线程池中所有任务都执行完成并设置超时时间boolean awaitTermination(long timeout, TimeUnit unit)throws InterruptedException;//向线程池中提交一个Callable类型的任务并返回一个Future类型的结果T FutureT submit(CallableT task);//向线程池中提交一个Runnable类型的任务并且给定一个T类型的收集结果集的参数并返回一个Future类型的结果T FutureT submit(Runnable task, T result);//向线程池中提交一个Runnable类型的任务并返回一个Future类型的结果Future? submit(Runnable task);//执行全部提交Callable类型的tasks任务集合并返回一个Future类型的结果集集合T ListFutureT invokeAll(Collection? extends CallableT tasks)throws InterruptedException;//执行全部提交Callable类型的tasks任务集合并且设置超时时间并返回一个Future类型的结果集集合T ListFutureT invokeAll(Collection? extends CallableT tasks,long timeout, TimeUnit unit)throws InterruptedException;//执行提交Callable类型的tasks任务集合并返回一个已经执行成功的任务结果T T invokeAny(Collection? extends CallableT tasks)throws InterruptedException, ExecutionException;//执行提交Callable类型的tasks任务集合并设置超时时间并返回一个已经执行成功的任务结果T T invokeAny(Collection? extends CallableT tasks,long timeout, TimeUnit unit)throws InterruptedException, ExecutionException, TimeoutException; }AbstractExecutorService public abstract class AbstractExecutorService implements ExecutorService {//将Runnable类型的任务包装成FutureTaskprotected T RunnableFutureT newTaskFor(Runnable runnable, T value) {return new FutureTaskT(runnable, value);}//将Callable类型的任务包装成FutureTaskprotected T RunnableFutureT newTaskFor(CallableT callable) {return new FutureTaskT(callable);}//向线程池中提交一个Runnable类型的任务并把该任务包装成RunnableFuture类型并执行该任务并且返回一个Future类型的结果public Future? submit(Runnable task) {if (task null) throw new NullPointerException();RunnableFutureVoid ftask newTaskFor(task, null);execute(ftask);return ftask;}//向线程池中提交一个Runnable类型的任务并设定一个T类型的参数用于包装返回值结果并把该任务包装成RunnableFuture类型并执行该任务并且返回一个Future类型的结果public T FutureT submit(Runnable task, T result) {if (task null) throw new NullPointerException();RunnableFutureT ftask newTaskFor(task, result);execute(ftask);return ftask;}//向线程池中提交一个Callable类型的任务并把该任务包装成RunnableFuture类型并执行该任务并且返回一个Future类型的结果public T FutureT submit(CallableT task) {if (task null) throw new NullPointerException();RunnableFutureT ftask newTaskFor(task);execute(ftask);return ftask;}//向线程池中提交一个tasks任务集合并设置是否超时及超时时间并得到一个已经执行完毕任务的结果private T T doInvokeAny(Collection? extends CallableT tasks,boolean timed, long nanos)throws InterruptedException, ExecutionException, TimeoutException {//集合是null或空抛出异常if (tasks null)throw new NullPointerException();//拿到任务数量int ntasks tasks.size();if (ntasks 0)throw new IllegalArgumentException();//存放任务执行结果ArrayListFutureT futures new ArrayListFutureT(ntasks);//用于执行提交的任务ExecutorCompletionServiceT ecs new ExecutorCompletionServiceT(this);try {//可能抛出的异常ExecutionException ee null;//超时时间final long deadline timed ? System.nanoTime() nanos : 0L;//获取一个任务Iterator? extends CallableT it tasks.iterator();//再循环之前先提交指定一个任务保证循环之前任务已经开始执行futures.add(ecs.submit(it.next()));--ntasks;//任务数量减一int active 1;//记录正在执行任务的数量for (;;) {//从完成任务的BlockingQueue队列中获取并移除下一个将要完成的任务的结果。 poll()为非阻塞方法FutureT f ecs.poll();if (f null) {//还有未完成的任务if (ntasks 0) {--ntasks;//继续执行任务futures.add(ecs.submit(it.next()));active;}else if (active 0)//如果没有正在执行的任务则跳出循环//这里加这个判断是因为poll()方法是非阻塞的 可能active0,但结果集还没有返回break;else if (timed) {//超时则设置超时时间f ecs.poll(nanos, TimeUnit.NANOSECONDS);if (f null)throw new TimeoutException();nanos deadline - System.nanoTime();}elsef ecs.take();}if (f ! null) {--active;try {//只要有一个结果集不为空则直接返回不会继续向下执行return f.get();} catch (ExecutionException eex) {ee eex;} catch (RuntimeException rex) {ee new ExecutionException(rex);}}}if (ee null)ee new ExecutionException();throw ee;} finally {//判断存在还未执行的任务则直接取消for (int i 0, size futures.size(); i size; i)futures.get(i).cancel(true);}}public T T invokeAny(Collection? extends CallableT tasks)throws InterruptedException, ExecutionException {try {return doInvokeAny(tasks, false, 0);} catch (TimeoutException cannotHappen) {assert false;return null;}}public T T invokeAny(Collection? extends CallableT tasks,long timeout, TimeUnit unit)throws InterruptedException, ExecutionException, TimeoutException {return doInvokeAny(tasks, true, unit.toNanos(timeout));}//执行提交的所有任务并返回结果集public T ListFutureT invokeAll(Collection? extends CallableT tasks)throws InterruptedException {if (tasks null)throw new NullPointerException();ArrayListFutureT futures new ArrayListFutureT(tasks.size());//这个标识代表当前所有任务是否都已经执行完成//无论是正常执行还是异常都算是已完成boolean done false;try {//遍历所有任务执行for (CallableT t : tasks) {RunnableFutureT f newTaskFor(t);futures.add(f);execute(f);}//遍历结果集for (int i 0, size futures.size(); i size; i) {FutureT f futures.get(i);//还没有执行完的任务阻塞继续执行直至返回结果if (!f.isDone()) {try {f.get();} catch (CancellationException ignore) {} catch (ExecutionException ignore) {}}}//标志所有任务都已完成done true;return futures;} finally {//如果存在还没有完成的任务则直接取消if (!done)for (int i 0, size futures.size(); i size; i)futures.get(i).cancel(true);}}//同上只不过在执行任务时和获取结果时设置了超时时间public T ListFutureT invokeAll(Collection? extends CallableT tasks,long timeout, TimeUnit unit)throws InterruptedException {if (tasks null)throw new NullPointerException();long nanos unit.toNanos(timeout);ArrayListFutureT futures new ArrayListFutureT(tasks.size());boolean done false;try {for (CallableT t : tasks)futures.add(newTaskFor(t));final long deadline System.nanoTime() nanos;final int size futures.size();// Interleave time checks and calls to execute in case// executor doesnt have any/much parallelism.for (int i 0; i size; i) {execute((Runnable)futures.get(i));nanos deadline - System.nanoTime();if (nanos 0L)return futures;}for (int i 0; i size; i) {FutureT f futures.get(i);if (!f.isDone()) {if (nanos 0L)return futures;try {f.get(nanos, TimeUnit.NANOSECONDS);} catch (CancellationException ignore) {} catch (ExecutionException ignore) {} catch (TimeoutException toe) {return futures;}nanos deadline - System.nanoTime();}}done true;return futures;} finally {if (!done)for (int i 0, size futures.size(); i size; i)futures.get(i).cancel(true);}}}ScheduledExecutorService public interface ScheduledExecutorService extends ExecutorService {//延时delay时间来执行command任务只执行一次public ScheduledFuture? schedule(Runnable command,long delay, TimeUnit unit);//延时delay时间来执行callable任务只执行一次public V ScheduledFutureV schedule(CallableV callable,long delay, TimeUnit unit);//延时initialDelay时间首次执行command任务之后每隔period时间执行一次public ScheduledFuture? scheduleAtFixedRate(Runnable command,long initialDelay,long period,TimeUnit unit);//延时initialDelay时间首次执行command任务之后每延时delay时间执行一次public ScheduledFuture? scheduleWithFixedDelay(Runnable command, long initialDelay,long delay,TimeUnit unit);}
http://www.zqtcl.cn/news/213776/

相关文章:

  • 好的 做网站的软件公司pinterest app下载
  • 公司网站报价邯郸软件定制
  • 产品毕业设计代做网站资料库网站源码
  • 交易类网站做支付宝功能建设银行网站收款怎么打明细
  • 广州找人做网站做网站网关备案
  • 网站的布局方式有哪些内容免费ppt模板下载公众号
  • 色91Av做爰网站获胜者网站建设
  • 企业做网站要多少钱简单网页设计模板网站
  • 住宅城乡建设部门户网站seo主管的seo优化方案
  • 商洛做网站电话北京做网站比较大的公司
  • 某俄文网站电脑做网站服务器
  • 广州网站建设开发团队江苏省建设招标网站
  • 南昌建设工程质量监督网站wordpress菜单登录
  • 网站设计贵不贵网站seo设置是什么
  • 不属于企业网站建设基本标准的是南通网站建设知识
  • 玉树州wap网站建设公司做试玩网站
  • 商城网站怎么建保定网络营销网站建设
  • 检索类的网站建设公司的网站建设规划书
  • 百度做网站需要交钱吗保定网站建设平台分析
  • 张家界建设局网站电话优化关键词排名公司
  • 宁夏网站建设一条龙网站建设中的图片及视频要求
  • 某些网站dns解析失败湛江制作企业网站
  • 网站开发用什么代码长沙哪家公司做网站
  • 做视频找素材的网站有哪些wordpress 合法评论
  • php网站开发程序填空题高水平网站运营托管
  • 揭东建设局网站wordpress建站后发布
  • 济南哪里有建网站制作视频的手机软件
  • 建设教育网站的国内外研究现状沧州市宇通网站建设公司
  • 大型网站开发框架有哪些厦门外贸网页设计服务
  • 开网站空间流量怎么选择公司注册咨询电话