atitit.taskService 任务管理器的设计 v1

任务管理器的点

Sametime_exe_count

Per task sleepMillSec

Timeout_secs

作者:: 绰号:老哇的爪子 ( 全名::Attilax Akbar Al Rapanui 阿提拉克斯 阿克巴 阿尔 拉帕努伊 ) 汉字名:艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

package com.attilax.task;

import java.io.File;

import java.util.concurrent.Callable;

import java.util.concurrent.ExecutorService;

import java.util.concurrent.Executors;

import java.util.concurrent.FutureTask;

import java.util.function.Function;

import org.openqa.jetty.http.SSORealm;

import org.sikuli.script.Screen;

import com.attilax.io.filex;

import com.attilax.io.pathx;

public class TaskService {

public  ExecutorService fixedThreadPool;

private int threadCount;

private Callable task;

private int pertask_sleeptime_millsecs;

private Function task_getter;

public static void main(String[] args) {

new filex().In_the_pc_machine_directory("c:\\0011windows")

.written_to_the_file().comma()

.the_content_is("om_mani_padme_hum").the_file_name_is_random()

.the_extension_is("txt").exe_single();

System.out.println("--f");

Callable task_my = new Callable() {

@Override

public Object call() {

new filex().In_the_pc_machine_directory("c:\\0011windows")

.written_to_the_file().comma()

.the_content_is("om_mani_padme_hum").the_file_name_is_random()

.the_extension_is("txt").exe_single();

return null;

}

};

Function task_getter=new Function<Object,Callable>() {

@Override

public Callable apply(Object t) {

return task_my;

}

};

new TaskService().setTask(task_my).TasksCount(10).at_the_same_time().and_pertask_sleeptime_millsecs_is(100).exe();

}

private TaskService setTask(Callable task_my) {

//this.task_getter=task_my;

this.task=task_my;

return this;

}

private void exe() {

fixedThreadPool = Executors.newFixedThreadPool(this.threadCount);

//Callable apply = (Callable) this.task_getter.apply(null);

//FutureTask<Object> task = new FutureTask<Object>(apply);

for (double i = 5; i >0; ) {

try {

FutureTask<Object> task = new FutureTask<Object>(this.task);

fixedThreadPool.execute(task);

Thread.sleep(this.pertask_sleeptime_millsecs);

//i++

} catch (Exception e) {

e.printStackTrace();

}

}

}

private TaskService and_pertask_sleeptime_millsecs_is(int i) {

this.pertask_sleeptime_millsecs=i;

return this;

}

private TaskService at_the_same_time() {

// TODO Auto-generated method stub

return this;

}

private TaskService TasksCount(int i) {

this.threadCount=i;

return this;

}

}

atitit.taskService 任务管理器的设计 v1的更多相关文章

  1. Atitit 项目的主体设计与结构文档 v5

    Atitit 项目的主体设计与结构文档 v5 1. 版本历史说明2 2. 功能大概说明2 3. 实现的目标3 3.1. cross device跨设备(pc 手机 平板)3 3.2. cross sc ...

  2. Atitit. null错误的设计 使用Optional来处理null

    Atitit. null错误的设计 使用Optional来处理null 然后,我们再看看null还会引入什么问题. 看看下面这个代码: String address = person.getCount ...

  3. Atitit 项目的主体设计与结构文档 v3

    Atitit 项目的主体设计与结构文档 v3 1. 实现的目标2 1.1. cross device跨设备(pc 手机 平板)作为规划2 1.2. 企业级Java体系与开发语言2 1.3. 高扩展性, ...

  4. Atitit.api参数传递的设计

    Atitit.api参数传递的设计 · 引言 · 形参和实参 · 命名实参 · 可选参数 · params,数目可变参数 · 方法解析与重载决策 · 参数传递      [重难点] · ref引用参数 ...

  5. Eclipse+Selenium自动化测试脚本设计V1.0

    Eclipse+Selenium自动化测试脚本设计V1.0 http://www.docin.com/p-803032251.html

  6. atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结

    atitit.导出excel的设计----查询结果 导出为excel的实现java .net php 总结 1. 基本的流程 查询获得list 读取jsp的table获得标题and 字段的map to ...

  7. atitit.html编辑器的设计要点与框架选型 attilax总结

    atitit.html编辑器的设计要点与框架选型 attilax总结 1. html编辑器的设计要求1 1.1. 障碍訪问 1 1.2. 强大Ajax上传 1 1.3. Word完美支持 2 1.4. ...

  8. Atitit jquery  1.4--v1.11  v1.12  v2.0  3.0 的新特性

    Atitit jquery  1.4--v1.11  v1.12  v2.0  3.0 的新特性 1.1. Jquery1.12  jQuery 2.2 和 1.12 新版本发布 - OPEN资讯.h ...

  9. Atitit 通用接口的设计与实现attilax 总结

    Atitit 通用接口的设计与实现attilax 总结 1.1. 现存的情况1 1.2. 接口返回类型,与返回序列化格式1 1.3. 异常传递 代替返回值模式1 1.4. 通用接口原理1 1.5. A ...

随机推荐

  1. 选择快速源来加速linux系统更新

    sudo pacman-mirrors -c China -g 引用自manjaro百度贴吧

  2. ZOJ 3949 Edge to the Root(树形DP)

    [题目链接] http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3949 [题目大意] 给出一棵根为1的树,每条边边长为1,请你 ...

  3. 【可持久化Trie】模板

    总算找到个能看懂的了,orz Lavender. #define INF 2147483647 #define N 100001 #define MAXBIT 31 int root[N],ch[N* ...

  4. 【数论】【枚举约数】【欧拉函数】bzoj2705 [SDOI2012]Longge的问题

    ∵∑gcd(i, N)(1<=i <=N) =k1*s(f1)+k2*s(k2)+...+km*s(km) {ki是N的约数,s(ki)是满足gcd(x,N)=ki(1<=x< ...

  5. 1.3(Spring学习笔记)Spring-AOP

    一.AOP简介 AOP面向切面编程,是将一种横向抽取机制,将多个类中需要使用的方法提取出来. 例如,这里有两个类,一个Cat,一个Dog,动物都需要吃饭睡觉,如果按照传统的思想. 给两类中都添加吃饭和 ...

  6. Bootstrap-datetimepicker日期插件简单使用

    写在前面: 日期组件有很多,这里简单的记录下bootstrap的一个日期插件datetimepicker,使用方法比较简单,基本上看一些就会了,但是还是记录下. 这个就不过多的说了,简单粗暴上代码 & ...

  7. STL之priority_queue3

    描述 使用STL中的优先队列,将n个点按照横坐标从小到大顺序排序,如果横坐标相同,按照纵坐标从小到大排序. 部分代码已经给出,请补充完整,提交时请勿包含已经给出的代码. int main() { in ...

  8. Java高级架构师(一)第10节:Spring+Mybatis实现DAO

    maven配置memcached.jar 由于目前java memcached client没有官方的maven repository可供使用,因此使用时需要手动将其安装到本地repository. ...

  9. HTML5 Boilerplate笔记(2)(转)

    最近看到了HTML5 Boilerplate模版,系统的学习与了解了一下.在各种CSS库.JS框架层出不穷的今天,能看到这么好的HTML模版,感觉甚爽.写篇博客,推荐给大家使用.   一:HTML5 ...

  10. 配置SSH单向无密码访问

    服务器架构:系统:CentOS 6.5 x64主控端A:192.168.0.150远端主机B:192.168.0.151 原理: 利用ssh key生成公钥.私钥,密钥相当于一把钥匙,而公钥就相当于一 ...