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. leetcode171 Excel Sheet Column Number

    题意: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 思路:找规律,挺简单的···可是小地方错了一些搞了半天 ...

  2. 设计高效SQL: 一种视觉的方法

    行; 这听起来很直观,但最有效的方法是什么?你可能有如下选择:行,其中有50行你必须剔除行,其中有450行你必须剔除行中剔除50行听起来比从500行中剔除450行更高效,但是请记住:聚簇,或者说,数据 ...

  3. Largest Divisible Subset -- LeetCode

    Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of ...

  4. [BZOJ 1794] Linear Garden

    Link: BZOJ 1794 传送门 Solution: IOI2008官方题解:传送门 要求序号,其实就是算字典序比其小的序列个数 从而使用数位$dp$的思想来解题,关键在于维护序列要$balan ...

  5. 【分块】hdu5057 Argestes and Sequence

    分块,v[i][j][k]表示第i块内第j位是k的元素数.非常好写.注意初始化 要注意题意,①第i位是从右往左算的. ②若x没有第i位,则用前导零补齐10位.比如103---->00000001 ...

  6. 【枚举】【二分答案】【分块答案】【BFS】【最大流】【Dinic】bzoj1189 [HNOI2007]紧急疏散evacuate

    [法一]枚举Time(0~N*M): S->'.'(1); 'D'->T(Time); '.'->'D'(dis(用BFS预处理,注意一旦到达'D',BFS就不能继续扩展了,注意di ...

  7. 【数论】【快速幂】bzoj1008 [HNOI2008]越狱

    根据 高中的数学知识 即可推出 ans=m^n-m*(m-1)^(n-1) .快速幂取模搞一下即可. #include<cstdio> using namespace std; typed ...

  8. display:block什么时候使用

    所有的块级元素不需要再在使用display:block定义,块级元素本身的默认属性就是block display:block:比较常用于<a><span>这两个标签,因为他们不 ...

  9. Delphi~通过程序窗体句柄获取程序路径

    http://www.cnblogs.com/Jesses/articles/1636323.html 引用PsAPI var  h:HWND;  pid: Cardinal;  pHandle: T ...

  10. PostgreSQL配置文件--资源使用(除WAL外)

    2 资源使用(除WAL外) RESOURCE USAGE (except for WAL) 2.1 内存 Memory 2.1.1 shared_buffers 数字型 默认: shared_buff ...