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. DeprecationWarning: current URL string parser is deprecated解决方法

    我最近在使用mongoDB的时候,发现了这个警告语句,纳闷了,按照官方文档的教程去连接数据库还能出错,也是醉了. 后来尝试去阅读相关资料,发现只是需要将{ useNewUrlParser: true ...

  2. DNS隧道工具dns2tcp

    DNS隧道工具dns2tcp   在很多网络环境中,防火墙会限制出站流量,主机往往只能访问外网主机有限的几个端口,如DNS的53端口.这时,就可以通过DNS请求和响应机制,建立通信隧道.Kali Li ...

  3. [BZOJ 3152] 组合子逻辑

    Link: BZOJ 3152 传送门 Solution: 喜闻乐见,gyz出的语文题,题意要看半小时 题意:使用最少的括号将序列分割,对于每个括号中的序列,设最左边的数为$num$,序列中元素个数为 ...

  4. 【2-SAT】Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) D. Innokenty and a Football League

    先反复地扫(不超过n次),把所有可以确定唯一取法的给确定下来. 然后对于剩下的不能确定的,跑2-SAT.输出可行解时,对于a和¬a,如果a所在的强连通分量序号在¬a之前,则取a,否则不取a.如果a和¬ ...

  5. 【kd-tree】bzoj3489 A simple rmq problem

    Orz zyf教给蒟蒻做法 蒟蒻并不会这题正解……(可持久化树套树?...Orz 对于每个点,我们可以求出pre[i],nex[i],那么询问的答案就是:求max (a[i]),其中 i 满足(pre ...

  6. 对象数组的初始化:null reference

    今天写代码的时候,发现我写的对象数组,只声明,而没有初始化,所以记录一下这个问题:null reference. Animals [] an=new Animals[5];//这只是个对象类型数组的声 ...

  7. NHibernate官方文档中文版——持久化类(Persistent Classes)

    持久化类是一个应用程序中的类,主要用来实现业务逻辑(例如,在电商应用中的客户和订单类).持久化类,就像它的名字一样,生命周期短暂并且用来持久化的据库对象实例. 如果这些类的构造能够依照一些简单的原则, ...

  8. Linux之ps查找进程用kill终止命令

    http://www.cnblogs.com/peida/archive/2012/12/20/2825837.html http://blog.csdn.net/andy572633/article ...

  9. WebApi单元测试记录

    一.MessageHandler不一定是全局的,也可以只应用到指定的Router上 .定义一个handler // Pipelines HttpMessageHandler affiliateShip ...

  10. UVA-10603-Fill(BFS+优先队列)

    There are three jugs with a volume of a, b and c liters. (a, b, and c are positive integers not grea ...