org.hy.common.Date Java Examples

The following examples show how to use org.hy.common.Date. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JU_Execute_LongWaitNewObject.java    From hy.common.base with Apache License 2.0 6 votes vote down vote up
public static void main(String [] args) throws Throwable
{
    Execute v_Execute = new Execute(new JU_Execute_LongWaitNewObject() ,"newObject");
    
    v_Execute.start(1000 * 5 * 2);
    
    v_Execute.waitting(System.out);
    
    
    System.out.println("\n-- 运行开始时间:" + v_Execute.getRunBeginTime().toString());
    System.out.println(  "-- 运行结束时间:" + v_Execute.getRunEndTime()  .toString());
    System.out.println(  "-- 运行用时时长:" + Date.toTimeLen(v_Execute.getRunTimeLen()));
    if ( v_Execute.isError() )
    {
        if ( v_Execute.isTimeout() )
        {
            System.out.println("-- 运行超时");
        }
        
        throw v_Execute.getException();
    }
    else
    {
        System.out.println("-- 成功执行方法.");
    }
}
 
Example #2
Source File: JU_Date.java    From hy.common.base with Apache License 2.0 6 votes vote down vote up
@Test
public void test_getDateByWork()
{
    this.test01(0);
    
    Date v_Now = new Date("2016-07-15");
    
    for (int v_WorkDay=0; v_WorkDay<=366 * 4; v_WorkDay++)
    {
        Date v_WorkDate = v_Now.getDateByWork(v_WorkDay * -1);
        System.out.println(v_WorkDate.getYMD() + "    星期" + v_WorkDate.getWeek() + "\t" + v_WorkDay);
        
        if ( v_WorkDate.getWeek() == 1 )
        {
            System.out.println("");
        }
    }
}
 
Example #3
Source File: JU_XJSON.java    From hy.common.base with Apache License 2.0 6 votes vote down vote up
public JU_XJSON(String i_SID ,String i_Sign ,double i_Double)
{
    this.FORMAT      = "json";
    this.LENGTH      = "70";
    this.MID         = "0d653fbb-e09c-4521-8571-1a4f2b4e4f6a";
    this.REQTIME     = new Date();
    
    try
    {
        Thread.sleep(1000);
    }
    catch (Exception exce)
    {
        exce.printStackTrace();
    }
    
    this.SID         = i_SID;
    this.SIGN        = i_Sign;
    this.doubleValue = i_Double;
    this.SYSID       = "1002";
    this.TOKEN       = "427034796155AD7610BCDC9F091F7AA9";
    this.BODY        = new JU_XJSON_BODYType();
}
 
Example #4
Source File: JU_Report01.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
public List<ExcelBean> getDatas(int i_DataSize)
{
    List<ExcelBean> v_Ret = new ArrayList<ExcelBean>();
    
    for (int i=0; i<i_DataSize; i++)
    {
        ExcelBean v_Bean = new ExcelBean();
        
        v_Bean.setAge(i);
        v_Bean.setName("Name " + i);
        v_Bean.setDate(new Date());
        v_Bean.setImage("/Volumes/HY_HD_06/WSS/WorkSpace_SearchDesktop/hy.common.report/images/" + i + ".jpg");
        
        v_Ret.add(v_Bean);
    }
    
    return v_Ret;
}
 
Example #5
Source File: SysTimeTest.java    From hy.common.tpool with Apache License 2.0 6 votes vote down vote up
/**
 * 间隔多少毫秒输出当前操作系统的时间一次。
 * 
 * @author      ZhengWei(HY)
 * @createDate  2018-12-05
 * @version     v1.0
 *
 * @param i_Millisecond  间隔毫秒
 * @throws InterruptedException
 */
public String show(long i_Millisecond) throws InterruptedException
{
    StringBuilder v_Buffer = new StringBuilder();
    long          v_Count  = 60 * 1000 / i_Millisecond;
    
    for (int i=1; i<=v_Count; i++)
    {
        v_Buffer.append(Date.getNowTime().getFullMilli()).append("\n");
        
        Thread.sleep(i_Millisecond);
    }
    
    System.out.println("System time test:Output every " + i_Millisecond + " millisecond.\n" + v_Buffer.toString());
    return v_Buffer.toString();
}
 
Example #6
Source File: Job.java    From hy.common.tpool with Apache License 2.0 6 votes vote down vote up
/**
 * 设置:开始时间组。多个开始时间用分号分隔。多个开始时间对 "间隔类型:秒、分" 是无效的(只取最小时间为开始时间)
 * 
 * @param i_StartTimesStr
 */
public void setStartTime(String i_StartTimesStr)
{
    if ( Help.isNull(i_StartTimesStr) )
    {
        return;
    }
    
    this.startTimes = new ArrayList<Date>();
    String [] v_STimeArr = StringHelp.replaceAll(i_StartTimesStr ,new String[]{"\t" ,"\n" ,"\r"} ,new String[]{""}).split(",");
    for (String v_STime : v_STimeArr)
    {
        this.startTimes.add(new Date(v_STime.trim()));
    }
    
    Help.toSort(this.startTimes);
}
 
Example #7
Source File: JU_Brace.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
public List<Brace> getDatas(int i_Size)
{
    List<Brace> v_Dates = new ArrayList<Brace>();
    
    for (int i=0; i<i_Size; i++)
    {
        Brace v_Data = new Brace();
        
        v_Data.setDepartName("部门名称" + i);
        
        v_Dates.add(v_Data);
    }
    
    
    v_Dates.get(0).setBeginDate("2018-01-01");
    v_Dates.get(0).setEndDate(  "2018-05-04");
    v_Dates.get(0).setExportTime(Date.getNowTime().getYMD());
    
    return v_Dates;
}
 
Example #8
Source File: JU_Total03.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
@Test
public void test_Subtotal() throws RTemplateException
{
    RTemplate v_RTemplate01 = (RTemplate)XJava.getObject("PartSprayRecordStatistics");
    RTemplate v_RTemplate02 = (RTemplate)XJava.getObject("PartSprayRecordStatistics_t");
    
    
    List<PartSprayRecordGroup> v_Datas = getDatas(10);
    
    Date v_BeginTime = new Date();
    RWorkbook v_RWorkbook = null;
    
    v_RWorkbook = ReportHelp.toExcel(v_RWorkbook ,v_Datas ,v_RTemplate01);
    v_RWorkbook = ReportHelp.toExcel(v_RWorkbook ,v_Datas ,v_RTemplate02);
    
    ExcelHelp.save(v_RWorkbook.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\PartSprayRecordStatistics");
    Date v_EndTime  = new Date();
    
    System.out.println(v_EndTime.getTime() - v_BeginTime.getTime());
}
 
Example #9
Source File: Job.java    From hy.common.tpool with Apache License 2.0 6 votes vote down vote up
public Job()
{
    super("$JOB$");
    
    this.startTimes      = new ArrayList<Date>();
    this.startTimes.add(Date.getNowTime().getNextHour().getFirstTimeOfHour());
    this.nextTime        = null;
    this.nextTimes       = null;
    this.intervalType    = $IntervalType_Manual;
    this.intervalLen     = 1; 
    this.taskCount       = 1;
    this.isInitExecute   = false;
    this.isAtOnceExecute = false;
    this.lastTime        = null;
    this.runCount        = 0;
    this.runLogs         = new Busway<String>(1440);
}
 
Example #10
Source File: Job.java    From hy.common.tpool with Apache License 2.0 6 votes vote down vote up
/**
 * 获取下一次运行时间
 * 
 * @return
 */
public Date getNextTime()
{
    if ( this.intervalType == $IntervalType_Second )
    {
        return this.getNextTime(Date.getNowTime());
    }
    else if ( this.lastTime == null || this.nextTime == null )
    {
        return this.getNextTime(Date.getNowTime());
    }
    else if ( this.lastTime.equalsYMDHM(this.nextTime) )
    {
        return this.getNextTime(Date.getNowTime().getMinutes(1));
    }
    else
    {
        return this.getNextTime(Date.getNowTime());
    }
}
 
Example #11
Source File: JU_ImageReport02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Image02() throws RTemplateException
{
    RTemplate             v_RTemplate = (RTemplate)XJava.getObject("Report_Image02_xlsx");
    List<ImageReportBean> v_Datas     = this.getDatas(3);
    
    RWorkbook v_RWorkbook02 = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    
    ExcelHelp.save(v_RWorkbook02.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #12
Source File: JU_AppendPage.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_AppendPage() throws RTemplateException
{
    RTemplate             v_RTemplate01 = (RTemplate)XJava.getObject("Report_AppendPage_1_xlsx");
    RTemplate             v_RTemplate02 = (RTemplate)XJava.getObject("Report_AppendPage_2_xlsx");
    List<ImageReportBean> v_Datas       = this.getDatas(2);
    
    RWorkbook v_RWorkbook = ReportHelp.toExcel(v_Datas ,v_RTemplate01); // 按第一个模板生成数据
    
    ReportHelp.toExcel(v_RWorkbook ,v_Datas ,v_RTemplate02 ,true);      // 追加第二个模板的数据
    
    ExcelHelp.save(v_RWorkbook.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\AppendPage_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #13
Source File: JU_Total03.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public List<PartSprayRecordGroup> getDatas(int i_OrgSize)
{
    List<PartSprayRecordGroup> v_Orgs = new ArrayList<PartSprayRecordGroup>();
    
    for (int i=1; i<=i_OrgSize; i++)
    {
        PartSprayRecordGroup v_Org = new PartSprayRecordGroup();
        
        v_Org.setDepartName("" + i);
        v_Org.setBeginDate( Date.getNowTime().getFull());
        v_Org.setEndDate(   Date.getNowTime().getFull());
        v_Org.setExportTime(Date.getNowTime().getFull());
        
        v_Org.setOperator("" + i);
        v_Org.setList(new ArrayList<PartSprayRecord>());
        
        for (int x=1; x<=i; x++)
        {
            PartSprayRecord v_Staff = new PartSprayRecord();
            
            v_Staff.setBatchNo("" + x);
            v_Staff.setItemCode("" + x);
            v_Staff.setPartName("" + x);
            v_Staff.setMaterial("" + x);
            v_Staff.setProcessClassify("" + x);
            v_Staff.setBs((double)x);
            
            
            v_Org.getList().add(v_Staff);
        }
        
        v_Orgs.add(v_Org);
    }
    
    return v_Orgs;
}
 
Example #14
Source File: TaskGroup.java    From hy.common.tpool with Apache License 2.0 5 votes vote down vote up
/**
 * 报告每个任务完成。
 * 
 * 当每个任务执行完成时,即在 Task.finishTask() 方法中,会自动调用此方法。
 * 
 * @param i_Task
 */
public synchronized void taskFinish(Task<?> i_Task)
{
	// 任务组已标记完成,就不在接收每个任务的报告了。
	if ( this.isTasksFinish() )
	{
		return;
	}
	
	
	int v_Size = this.taskList.size();
	
	this.plusFinishSize();
	// System.out.println(i_Task.getTaskName() + "  " + i_Task.getThreadNo() + "  " + this.finishSize);
	
	
	if ( this.finishSize > 0 && this.finishSize >= v_Size )
	{
	    this.tasksIsFinish = true;
	    
	    if ( this.taskGroupEvent != null )
	    {
   			this.taskGroupEvent.setCompleteSize(this.finishSize);
   			this.taskGroupEvent.setTasks(this.taskList.iterator());
   			this.taskGroupEvent.setEndTime(new Date());
   			
   			try
   			{
   				this.fireFinishAllTaskListener(this.taskGroupEvent);
   			}
   			catch (Exception exce)
   			{
   				exce.printStackTrace();
   			}
	    }
		
		this.taskGroupIsFinish = true;
		this.finishSize        = 0;
	}
}
 
Example #15
Source File: ThreadBase.java    From hy.common.tpool with Apache License 2.0 5 votes vote down vote up
/**
 * 内部使用的,并且调用此方法的父方法有同步锁synchronized,所以此方法不再添加同步锁synchronized。
 * 
 * @author      ZhengWei(HY)
 * @createDate  2018-08-23
 * @version     v1.0
 *
 * @param i_ThreadTaskRunStatus
 */
private void setThreadRunStatus_NoSync(ThreadRunStatus i_ThreadTaskRunStatus)
{
    this.threadRunStatus = i_ThreadTaskRunStatus;
       
       if ( this.threadRunStatus.equals(ThreadRunStatus.$Working) )
       {
           this.taskStartTime = new Date();
           this.taskEndTime   = null;
       }
       else if ( this.threadRunStatus.equals(ThreadRunStatus.$Finish) )
       {
           this.taskEndTime = new Date();
           this.totalTime   = this.totalTime + (this.taskEndTime.getTime() - this.taskStartTime.getTime());
       }
       
       if ( ThreadPool.isWatch() )
       {
           // 及时更新视窗化监视窗口的信息
           ThreadPoolWatch.getInstance().updateRow(this.watchTableRowIndex ,WatchTableColumnIndex.$RunStatus ,this.threadRunStatus.toString());
           
           if ( this.threadRunStatus.equals(ThreadRunStatus.$Finish) )
           {
               ThreadPoolWatch.getInstance().updateRow(this.watchTableRowIndex ,WatchTableColumnIndex.$ExecCount ,String.valueOf(this.executeTaskCount));
               ThreadPoolWatch.getInstance().updateRow(this.watchTableRowIndex ,WatchTableColumnIndex.$TotalTime ,this.getTotalTimeSec());
               ThreadPoolWatch.getInstance().updateRow(this.watchTableRowIndex ,WatchTableColumnIndex.$TaskDesc ,this.taskObject.getTaskDesc());
           }
       }
}
 
Example #16
Source File: JU_ImageReport02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Image05() throws RTemplateException
{
    RTemplate             v_RTemplate = (RTemplate)XJava.getObject("Report_Image05_xlsx");
    List<ImageReportBean> v_Datas     = this.getDatas(3);
    
    RWorkbook v_RWorkbook05 = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    v_RWorkbook05 = ReportHelp.toExcel(v_RWorkbook05 ,v_Datas ,v_RTemplate ,true);
    v_RWorkbook05 = ReportHelp.toExcel(v_RWorkbook05 ,v_Datas ,v_RTemplate ,true);
    
    ExcelHelp.save(v_RWorkbook05.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #17
Source File: JU_Formula.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
/**
 * 测试:带公式的报表生成
 * 
 * @author      ZhengWei(HY)
 * @createDate  2020-05-21
 * @version     v1.0
 *
 * @throws RTemplateException
 */
@Test
public void test_Formula() throws RTemplateException
{
    RTemplate             v_RTemplate = (RTemplate)XJava.getObject("Report_Formula_xlsx");
    List<ImageReportBean> v_Datas     = this.getDatas(3);
    
    RWorkbook v_RWorkbook = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    
    ExcelHelp.save(v_RWorkbook.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\Formula_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #18
Source File: JU_Total02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Subtotal() throws RTemplateException
{
    RTemplate v_RTemplate = (RTemplate)XJava.getObject("ReportTotalSubtotal");
    
    
    List<ProductPressureTestStatisticsGroup> v_Datas = getDatas(100);
    
    Date v_BeginTime = new Date();
    ExcelHelp.save(ReportHelp.toExcel("小计、分组数据的报表演示" ,v_Datas ,v_RTemplate).getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\TotalSubtotal");
    Date v_EndTime  = new Date();
    
    System.out.println(v_EndTime.getTime() - v_BeginTime.getTime());
}
 
Example #19
Source File: Jobs.java    From hy.common.tpool with Apache License 2.0 5 votes vote down vote up
/**
 * 运行
 */
public synchronized void startup()
{
    this.isMaster                   = false;
    this.disasterRecoveryJobIsValid = false;
    this.getMasterTime              = null;
    this.getMasterCount             = 0;
    
    if ( this.isDisasterRecovery() )
    {
        // Master主服务不监控Slave从服务,只有Slave从服务监控主服务的存活性。
        // 但,这里也必须先监控所有Slave从服务,只有监测到所有服务均正常时,才能移除Master主服务上的心跳监测。
        // 这是为了防止双Master服务现像出现。如,在B服务在启动时,A服务已启动在先,但因为网络等原因A服务暂时无法获取心跳监测的反馈。
        // B服务启动时,如果不添加上面断定,当A服务网络恢复后,就有可能出现双Master服务的问题。
        this.addJob(this.createDisasterRecoveryJob());
        this.disasterRecoveryJobIsValid = true;
    }
    
    Help.toSort(this.jobList ,"intervalType");
    
    // 遍历初始一次所有Job的下一次执行时间,防止首次执行时等待2倍的间隔时长
    if ( !Help.isNull(this.jobList) )
    {
        this.minIntervalType = this.jobList.get(0).getIntervalType();
        
        final Date v_Now = new Date();
        for (Job v_Job : this.jobList)
        {
            v_Job.getNextTime(v_Now);
        }
    }
    
    TaskPool.putTask(this);
    this.startTime = new Date();
}
 
Example #20
Source File: Job.java    From hy.common.tpool with Apache License 2.0 5 votes vote down vote up
/**
 * 是否允许执行
 * 
 * @author      ZhengWei(HY)
 * @createDate  2018-11-29
 * @version     v1.0
 *
 * @param i_Now  当前时间
 * @return
 */
public boolean isAllow(final Date i_Now)
{
    if ( this.jobs != null )
    {
        if ( this.jobs.isDisasterRecovery() )
        {
            if ( !this.jobs.isMaster() )
            {
                return Jobs.$JOB_DisasterRecoverys_Check.equals(this.xjavaID);
            }
        }
    }
    
    if ( Help.isNull(this.condition) )
    {
        return true;
    }
    
    try
    {
        FelContext v_FelContext = new MapContext();
        
        v_FelContext.set($Condition_Y   ,i_Now.getYear());
        v_FelContext.set($Condition_M   ,i_Now.getMonth());
        v_FelContext.set($Condition_D   ,i_Now.getDay());
        v_FelContext.set($Condition_H   ,i_Now.getHours());
        v_FelContext.set($Condition_MI  ,i_Now.getMinutes());
        v_FelContext.set($Condition_S   ,i_Now.getSeconds());
        v_FelContext.set($Condition_YMD ,Integer.parseInt(i_Now.getYMD_ID()));
        
        return (Boolean) $FelEngine.eval(this.condition ,v_FelContext);
    }
    catch (Exception exce)
    {
        throw new RuntimeException("Fel[" + this.condition + "] is error." + exce.getMessage());
    }
}
 
Example #21
Source File: JU_FontReport.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Font() throws RTemplateException
{
    RTemplate      v_RTemplate = (RTemplate)XJava.getObject("Report_Font_xlsx");
    List<FontTest> v_Datas     = this.getDatas(1);
    
    RWorkbook v_RWorkbook02 = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    
    ExcelHelp.save(v_RWorkbook02.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\FontReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #22
Source File: JU_ReportNormal.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
public List<OrgInfo> getDatas(int i_OrgSize)
{
    List<OrgInfo> v_Orgs = new ArrayList<OrgInfo>();
    
    for (int i=1; i<=i_OrgSize; i++)
    {
        OrgInfo v_Org = new OrgInfo();
        
        v_Org.setOrgNo(StringHelp.lpad(i ,3 ,"0"));
        v_Org.setOrgName("部门名称 1234567890中国qwertyuiop美国asdfghjkl英国zxcvbnm" + i);
        
        for (int x=1; x<=i*2; x++)
        {
            StaffInfo v_Staff = new StaffInfo();
            
            v_Staff.setStaffNo(v_Org.getOrgNo() + "-" + StringHelp.lpad(x ,3 ,"0"));
            v_Staff.setStaffName("员工名称 " + x);
            v_Staff.setTime(new Date());
            
            v_Org.getStaffs()  .add(v_Staff);
            v_Org.getStaffSet().add(v_Staff);
            v_Org.getStaffMap().put(v_Staff.getStaffNo() ,v_Staff);
        }
        
        v_Orgs.add(v_Org);
    }
    
    return v_Orgs;
}
 
Example #23
Source File: JU_ImageReport.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Image() throws RTemplateException
{
    //RTemplate             v_RTemplate01 = (RTemplate)XJava.getObject("Report_Image_xls");
    RTemplate             v_RTemplate02 = (RTemplate)XJava.getObject("Report_Image_xlsx");
    List<ImageReportBean> v_Datas       = this.getDatas(118);
    
    //RWorkbook v_RWorkbook01 = ReportHelp.toExcel(v_Datas ,v_RTemplate01);
    RWorkbook v_RWorkbook02 = ReportHelp.toExcel(v_Datas ,v_RTemplate02);
    
    //ExcelHelp.save(v_RWorkbook01.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xls");
    ExcelHelp.save(v_RWorkbook02.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}
 
Example #24
Source File: JU_XJSON.java    From hy.common.base with Apache License 2.0 5 votes vote down vote up
public JU_XJSON()
{
    this.FORMAT  = "json";
    this.LENGTH  = "70";
    this.MID     = "0d653fbb-e09c-4521-8571-1a4f2b4e4f6a";
    this.REQTIME = new Date();
    this.SID     = "SC2017000";
    this.SIGN    = "189FC061D401617CA12D255735A06671";
    this.SYSID   = "1002";
    this.TOKEN   = "427034796155AD7610BCDC9F091F7AA9";
    this.BODY    = new JU_XJSON_BODYType();
}
 
Example #25
Source File: JU_XJSON_BODYType.java    From hy.common.base with Apache License 2.0 5 votes vote down vote up
public JU_XJSON_BODYType()
{
    this.latnId     = "290";
    this.prodType   = "41010300";
    this.beginTime  = "20130801000000";
    this.endTime    = "20130815000000";
    this.channelId  = "1";
    this.staffId    = "KF01016";
    this.serviceNbr = "18066808930";
    this.hyDate     = new Date();
}
 
Example #26
Source File: JU_Socket.java    From hy.common.base with Apache License 2.0 5 votes vote down vote up
@Test
public void test_isAllowConnect()
{
    System.out.println("Socket通讯测试:开始时间 = " + Date.getNowTime().getFullMilli());
    boolean v_IsAllowConnect = Help.isAllowConnect("100.100.100.100" ,100 ,10 * 1000);
    System.out.println("Socket通讯测试:结束时间 = " + Date.getNowTime().getFullMilli());
    
    assertTrue(v_IsAllowConnect);
}
 
Example #27
Source File: TaskPool.java    From hy.common.tpool with Apache License 2.0 5 votes vote down vote up
public ScanTaskPoolTask() 
		{
			super($TaskType$);
			
			this.idleBeginTime = Date.getNowTime().getTime();
			this.scanIsRunning = true;
//			this.buffer        = new StringBuilder();
		}
 
Example #28
Source File: JU_Execute_MethodOverload.java    From hy.common.base with Apache License 2.0 5 votes vote down vote up
@Test
public void test_MethodOverload() throws InterruptedException
{
    new Execute(new JU_Execute_MethodOverload() ,"methodOverload").start();
    new Execute(new JU_Execute_MethodOverload() ,"methodOverload" ,"1234567890").start();
    new Execute(new JU_Execute_MethodOverload() ,"methodOverload" ,new Date()).start();
    new Execute(new JU_Execute_MethodOverload() ,"methodOverload" ,new Object()).start();
    
    Thread.sleep(1000 * 60 * 10);
}
 
Example #29
Source File: JU_ExpireMap.java    From hy.common.base with Apache License 2.0 5 votes vote down vote up
@Test
public void test_001() throws InterruptedException
{
    ExpireMap<String ,Date> v_ExpireMap = new ExpireMap<String ,Date>();
    
    long                 v_MilliSecond = 2;
    Date                 v_Now         = new Date();
    Date                 v_Time        = new Date(v_Now.getTime() + v_MilliSecond);
    String               v_Key         = v_Time.getFullMilli();
    Expire<String ,Date> v_Expire      = v_ExpireMap.put(v_Key ,v_Time ,v_MilliSecond);
    String               v_ETS         = (new Date(v_Expire.getTime())).getFullMilli();
    
    
    System.out.println("-- 当前时间:" + v_Now.getFullMilli());
    while ( true )
    {
        v_Time = v_ExpireMap.get(v_Key);
        
        if ( null != v_Time )
        {
            System.out.println("-- 当前时间:" + Date.getNowTime().getFullMilli() + "\t剩余时长:" + v_ExpireMap.getExpireTimeLen(v_Key));
        }
        else
        {
            System.out.println("-- 当前时间:" + Date.getNowTime().getFullMilli() + "\t过期时间:" + v_ETS);
            break;
        }
    }
    
    Iterator<String> v_Iterator = v_ExpireMap.keySet().iterator();
    while ( v_Iterator.hasNext() )
    {
        String v_ID = v_Iterator.next();
        
        System.out.println(v_ID);
    }
}
 
Example #30
Source File: JU_ImageReport02.java    From hy.common.report with Apache License 2.0 5 votes vote down vote up
@Test
public void test_Image03() throws RTemplateException
{
    RTemplate             v_RTemplate = (RTemplate)XJava.getObject("Report_Image03_xlsx");
    List<ImageReportBean> v_Datas     = this.getDatas(3);
    
    RWorkbook v_RWorkbook03 = ReportHelp.toExcel(v_Datas ,v_RTemplate);
    
    ExcelHelp.save(v_RWorkbook03.getWorkbook() ,"C:\\Users\\ZhengWei\\Desktop\\ImageReport_" + Date.getNowTime().getFull_ID() + ".xlsx");
}